📅  最后修改于: 2022-03-11 14:45:54.230000             🧑  作者: Mango
from collections import Counter
def word_count(fname):
with open(fname) as f:
return Counter(f.read().split())
print("Number of words in the file :",word_count("test.txt"))