Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

C

Name: Jhonson 2011-03-09 5:06

Can you help me write a program that finds what lowercase symbols are used most in a binary file?

Name: Anonymous 2011-03-09 5:11

Sure.

f = open('<your file>', 'rb')
h = {}
for c in f.read():
    if 'a' <= c <= 'z':
        if c not in h: h[c] = 0
        h[c] += 1
print sorted([(h[c], c) for c in h])

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List