from collections import Counter
import re
with open('a.txt', 'r', encoding='utf-8') as f:
txt = f.read()
c = Counter(re.split('\W+',txt)) #取出每个单词出现的个数print(c)
ret = c.most_common(10) #取出频率最高的前10个print(ret)
posted on
2018-01-30 19:41海燕。
阅读(1887)
评论(0)
编辑收藏举报