摘要: 1 from collections import defaultdict 2 3 a=[1,1,2,2,2,2,3,3,4,5,5,5,9,9,9] 4 5 def foo(a): 6 counts=defaultdict(int) 7 for x in a: 8 counts[x]+=1 9 print(counts) 1... 阅读全文
posted @ 2017-08-20 17:10 人到中年万事休 阅读(130) 评论(0) 推荐(0)