From b6de26b18b28a244643c671bd71ed92a88555ad4 Mon Sep 17 00:00:00 2001 From: Madhusudan.C.S Date: Fri, 9 Oct 2009 12:59:55 +0530 Subject: Final set of changes. --- day1/exercise/kwfreq.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'day1/exercise/kwfreq.py') 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 -- cgit