day1/exercise/word_frequencies.py
author Puneeth Chaganti <punchagan@fossee.in>
Fri, 10 Dec 2010 00:04:46 +0530
branchscipyin2010
changeset 449 49e10e9fc660
parent 380 669b72283b55
permissions -rw-r--r--
Fixed day2/session1.tex.

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