import collections
f=open(r'C:\Users\86156\Desktop\Walden.txt','r')
str1=f.read().split(' ')
m=collections.Counter(str1) #用于统计元素出现的次数
print(m
统计Walden中单词出现的次数
最新推荐文章于 2022-11-27 18:33:50 发布
import collections
f=open(r'C:\Users\86156\Desktop\Walden.txt','r')
str1=f.read().split(' ')
m=collections.Counter(str1) #用于统计元素出现的次数
print(m