blob: deb98022697b090875ece3b058ca5b35f491c714 (
plain)
1
2
3
4
5
6
7
8
9
10
11
|
f = open('/home/madhu/pyprogs/pytriads.py')
freq = {}
for line in f:
words = line.split()
for word in words:
key = word.strip(',.!;?\'" ')
value = freq.get(key, 1)
freq[key] = value + 1
print freq
|