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