day1/debug_exercise.py
author prabhu@localhost
Fri, 09 Oct 2009 22:57:00 +0530
changeset 93 27b67b50280b
parent 86 f657495cf8b2
permissions -rw-r--r--
ENH: Fixing compile errors and removing CDEEP.

import keyword
f = open('/path/to/file')

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

print freq