6 lines
212 B
Python
6 lines
212 B
Python
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")) |