5.3.2 Counter对象
Counter类提供一个方便和快速统计的工具。例子:#python 3.4import collections cnt = collections.Counter()for word in ['red', 'blue', 'red', 'green', 'blue', 'blue']: cnt[word] += 1print(cnt)结果输出如下:Counter({'blue': 3, 'r