How to sort very large arrays?

kj socyl at 987jk.com.invalid
Fri Jun 13 13:54:32 EDT 2008




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 sort command.  So,
from within a Perl script, I'd create a pipe handle through sort
and then just print the data through that handle:

  open my $out, "|$sort -t '\t' -k1,1 -k2,2 -u > $out_file" or die $!;
  print $out $_ for @data;

But that's distinctly Perlish, and I'm wondering what's the "Python
Way" to do this.

TIA!

kynn

-- 
NOTE: In my address everything before the first period is backwards;
and the last period, and everything after it, should be discarded.



More information about the Python-list mailing list