f = open('C:\\Users\\Administrator\\Desktop\\walden.txt','r')
f_line = f.readlines()
str = " ".join(f_line) #转为用分隔符“ ”连接的字符串
words = str.split() #按某一字符串“ ”分割
from collections import Counter #导入模块,计数
counter = Counter(words)
dictionary=dict(counter)
k=12000
res=counter.most_common(k)
print(res)
07-09
07-09
07-09
07-09
“相关推荐”对你有帮助么?
-
非常没帮助
-
没帮助
-
一般
-
有帮助
-
非常有帮助
提交