python 根据车牌信息,分析出各省的车牌持有量

cars = ['鲁A11111', '鲁B22222', '京B88888', '鲁C33333', '⿊C12345', '⿊C66666', '沪B00000']
local = {'沪': '上海', '⿊': '⿊⻰江', '鲁': '⼭东', '鄂': '湖北', '湘': '湖南', '京': '北京'}

result = {}
for key in local.keys():
    amount = 0
    for car_id in cars:
        if key == car_id[0]:
            amount += 1
            result.update({local.get(car_id[0]): amount})
print(result)
posted @ 2020-03-25 20:06  Jason857  阅读(652)  评论(0)    收藏  举报