sequence = ["beijing", "shanghai","beijing", "chongqing", "hubei", "guangzhou", "guangzhou", "shanghai", "beijing"]def get_count(sequence): i = {} for x in sequence: if x in i: i[x] += 1 else: i[x] = 1 return icounts = get_count(sequence)print counts 请问这串代码中,具体是怎样的运行顺序啊,i这个字典是什么时候生成的?x最初不是应该也是一个列表么,为什么x in i后就生成了字典了啊,没有理解这个
添加回答
举报
0/150
提交
取消