车牌区域划分,给出以下车牌,根据车牌信息,分析出各省的车牌持有量
Posted hemage
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了车牌区域划分,给出以下车牌,根据车牌信息,分析出各省的车牌持有量相关的知识,希望对你有一定的参考价值。
cars = [‘鲁A32444‘,‘鲁B12333‘,‘京B8989M‘,‘黑C49678‘,‘黑C46555‘,‘沪 B25041‘]
locals = {‘沪‘:‘上海‘,‘黑‘:‘黑龙江‘,‘鲁‘:‘山东‘,‘鄂‘:‘湖北‘,‘湘‘:‘湖南‘,‘京‘:‘北京‘}
dic = {}
for key,value in locals.items():
count = 0
for i in cars:
if key == i[0]:
count += 1
if count > 0:
dic[value] = count
print(dic)
#第二种
dic = {}
for i in cars:
if locals[i[0]] not in dic:
dic[locals[i[0]]] = 1
else:
dic[locals[i[0]]] = dic[locals[i[0]]] +1
print(dic)
#第三种
dic = {}
for i in cars:
dic[locals[i[0]]] = dic.get(locals[i[0]],0) + 1
print(dic)
以上是关于车牌区域划分,给出以下车牌,根据车牌信息,分析出各省的车牌持有量的主要内容,如果未能解决你的问题,请参考以下文章