RosettaCodeData/Task/Letter-frequency/Python/letter-frequency-1.py

8 lines
180 B
Python
Raw Permalink Normal View History

2013-04-10 21:29:02 -07:00
import collections, sys
def filecharcount(openfile):
return sorted(collections.Counter(c for l in openfile for c in l).items())
f = open(sys.argv[1])
print(filecharcount(f))