day1/exercise/kwfreq.py
changeset 86 f657495cf8b2
parent 64 333092b68926
child 180 e442b9e23972
--- a/day1/exercise/kwfreq.py	Thu Oct 08 19:45:43 2009 +0530
+++ b/day1/exercise/kwfreq.py	Fri Oct 09 12:59:55 2009 +0530
@@ -1,5 +1,5 @@
 import keyword
-f = open('/home/madhu/pyprogs/pytriads.py')
+f = open('/path/to/file')
 
 freq = {}
 for line in f:
@@ -7,7 +7,7 @@
     for word in words:
         key = word.strip(',.!;?()[]: ')
         if keyword.iskeyword(key):
-            value = freq.get(key, 1)
+            value = freq[key]
             freq[key] = value + 1
 
 print freq