K
kj
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
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