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 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: This is a python clone of your code from a python rookie :)
from os import popen p = popen("sort -t '\t' -k1,1 -k2,2 -u > %s" % out_file) for line in data: print >> p, line there is no "die $!" here, I think it is good to let python throw the exception to your console > > 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. -- http://mail.python.org/mailman/listinfo/python-list