998b6cc
1
2
3
4
5
6
7
8
from collections import Counter def word_frequency(file_path): with open(file_path, 'r') as f: words = f.read().split() return Counter(words) print(word_frequency('sample.txt'))