summaryrefslogtreecommitdiff
path: root/day1/exercise/kwfreq.py
diff options
context:
space:
mode:
authorMadhusudan.C.S2009-10-09 12:59:55 +0530
committerMadhusudan.C.S2009-10-09 12:59:55 +0530
commitb6de26b18b28a244643c671bd71ed92a88555ad4 (patch)
treeef3d4f9df2ceb21bd708acf5c953f176f619eb24 /day1/exercise/kwfreq.py
parent2f5e0db52e85b5e138ce74d87a7391d9a7276cd0 (diff)
downloadworkshops-more-scipy-b6de26b18b28a244643c671bd71ed92a88555ad4.tar.gz
workshops-more-scipy-b6de26b18b28a244643c671bd71ed92a88555ad4.tar.bz2
workshops-more-scipy-b6de26b18b28a244643c671bd71ed92a88555ad4.zip
Final set of changes.
Diffstat (limited to 'day1/exercise/kwfreq.py')
-rw-r--r--day1/exercise/kwfreq.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/day1/exercise/kwfreq.py b/day1/exercise/kwfreq.py
index 32a8765..0da7ff3 100644
--- a/day1/exercise/kwfreq.py
+++ b/day1/exercise/kwfreq.py
@@ -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 line in f:
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