On Fri, Jan 22, 2010 at 05:07:13PM EST, Arnaud Delobelle wrote: [..]
> import codecs > from collections import defaultdict > > tcounters = defaultdict(int) > f = codecs.open('/home/gavron/git/screen/src/screen.c', 'r', "utf-8") > > for c in f.read(): > tcounters[c] += 1 > > for c, n in tcounters.iteritems(): > print "%r\t%i" % (c, n) Ah, yes.. much better - I grew suspicious of my 'effort' when I realized I could have written a shorter version in C. :-) CJ -- http://mail.python.org/mailman/listinfo/python-list