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

8 lines
180 B
Python

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))