1 import collections 2 3 a = [1,2,3,1,2,3,4,1,2,5,4,6,7,7,8,9,6,2,23,4,2,1,5,6,7,8,2] 4 b = collections.Counter(a) 5 for c in b: print c,b[c]
时间: 2024-12-16 03:36:19
1 import collections 2 3 a = [1,2,3,1,2,3,4,1,2,5,4,6,7,7,8,9,6,2,23,4,2,1,5,6,7,8,2] 4 b = collections.Counter(a) 5 for c in b: print c,b[c]