Python collections.Counter用法详解
from collections import Counter
temp = Counter('abcdeabcdabcaba')
for item in temp.items():
print(item)
print(temp.most_common())
输出:
('a', 5)
('b', 4)
('c', 3)
('d', 2)
('e', 1)
[('a', 5), ('b', 4), ('c', 3), ('d', 2), ('e', 1)]```