summaryrefslogtreecommitdiff
path: root/day1/exercise/word_frequencies.py
blob: 1f7351c15a1c56b32123ff6c559a866b858b7a87 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
f = open('/home/vattam/Desktop/circulate/word-freq/holmes.txt')

freq = {}
for line in f:
    words = line.split()
    for word in words:
        key = word.strip(',.!;?\'" ')
        if key in freq:
            freq[key] += 1
        else:
            freq[key] = 1

print freq