Re: How to sort very large arrays?

2008-06-14 Thread rent
On Jun 14, 1:54 am, kj <[EMAIL PROTECTED]> wrote: > I'm downloading some very large tables from a remote site. I want > to sort these tables in a particular way before saving them to > disk. In the past I found that the most efficient way to do this > was to piggy-back on Unix's highly optimized

Re: How to sort very large arrays?

2008-06-14 Thread rent
On Jun 14, 1:54 am, kj <[EMAIL PROTECTED]> wrote: > I'm downloading some very large tables from a remote site. I want > to sort these tables in a particular way before saving them to > disk. In the past I found that the most efficient way to do this > was to piggy-back on Unix's highly optimized

Re: Learning Python via a little word frequency program

2008-01-11 Thread rent
import collections names = "freddy fred bill jock kevin andrew kevin kevin jock" freq = collections.defaultdict(int) for name in names.split(): freq[name] += 1 keys = freq.keys() keys.sort(key = freq.get, reverse = True) for k in keys: print "%-10s: %d" % (k, freq[k]) On Jan 9, 6:58 p