changeset 86 | f657495cf8b2 |
parent 30 | 3e21614218f4 |
85:8ca53181bee6 | 86:f657495cf8b2 |
---|---|
1 def no_bug(): |
1 import keyword |
2 for i in range(10): |
2 f = open('/path/to/file') |
3 if |
3 |
4 freq = {} |
|
5 for line in f: |
|
6 words = line.split() |
|
7 for word in words: |
|
8 key = word.strip(',.!;?()[]: ') |
|
9 if keyword.iskeyword(key): |
|
10 value = freq[key] |
|
11 freq[key] = value + 1 |
|
12 |
|
13 print freq |