Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- fname = raw_input("Enter file name: ")
- if len(fname) < 1 : fname = "mbox-short.txt"
- count = dict()
- fh = open(fname)
- for line in fh :
- if 'From: ' in line :
- line = line.split()
- word = line[1]
- counts[word] = counts.get(word,0)+1
- bigcount = None
- bigword = None
- for word,count in counts.items():
- if bigcount is None or count > bigcount:
- bigword = word
- bigcount = count
- print bigword,bigcount
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement