📜  python计算列表中单词的频率 - Python代码示例

📅  最后修改于: 2022-03-11 14:46:06.738000             🧑  作者: Mango

代码示例1
from collections import Counter
list1=['apple','egg','apple','banana','egg','apple']
counts = Counter(list1)

print(counts)
# Counter({'apple': 3, 'egg': 2, 'banana': 1})