I think there is a better way to do it.
Soumyo Dey

Something like this would work

import collections
import itertools

file_contents = collections.Counter([i for i in itertools.chain(*open('lipsum.txt')) if i.isalpha()])
for k, v in sorted(file_contents.items()):
print("{} : {}".format(k, v))
Like what you read? Give Bob Bibentyo a round of applause.

From a quick cheer to a standing ovation, clap to show how much you enjoyed this story.