for word, count in Counter(open('test.txt').read().lower().split()).most_common():
print word, count for word, count in Counter(open('test.txt').read().lower().split()).most_common():
print word, count words=open('test.txt').read().lower().split()
for word, count in Counter(words).most_common():
print word, count
(edited per child comment)One nitpick: it's Pythonic (I think) to just name the list of words "words" rather than "word_list".
Personally I always read entire files into memory first unless I have reason to believe memory will be an issue or need to program defensively against malicious/careless input. The code is always much cleaner and easier to read and if you need to do a second pass on the data you don't need to re-read it from disk.