import string totals = {} if __name__ == "__main__": import sys print "Calculating..." source = open(sys.argv[1]) totals = {} for line in source.readlines(): for letter in line: try: totals[letter] += 1 except: totals[letter] = 1 numcount = 0 for (key,val) in totals.items(): numcount += val print "total: %s" % (numcount) for (key,val) in totals.items(): print "%s ~ %s ~ %s" % (val,key, ord(key) )