Advertisement
cheungtifan

Untitled

Jun 12th, 2012
466
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.22 KB | None | 0 0
  1. from collections import Counter
  2. import re
  3. wc = Counter()
  4. infile = open("input.txt", "r")
  5. wordlist = []
  6. [wordlist.extend(re.findall("\w+", l)) for l in infile]
  7. for word in wordlist:
  8.     wc[word] += 1
  9. print wc.most_common(10)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement