diff options
Diffstat (limited to 'day1/exercise')
-rw-r--r-- | day1/exercise/kwfreq.py | 4 |
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 |