python——Counter函数统计列表中元素出现次数
不多说了,直接上例子加代码!from collections import Counterfrom collections import Counter #导入Counter函数a = ["a","b","b","c","c","c"]print(Counter(a))b = dict(Counter(a))#转化成字典print(b)print ([key for key,