[Tutor] opening a pipe?

James Hartley jjhartley at gmail.com
Tue Feb 12 10:24:23 CET 2008


A Perl script can easily serve as a filter within a pipe as seen in
the following:

use strict;
use warnings;

open(IN, 'cat hello.txt |') or die 'unable to open file';
while (<IN>) {
    print;
}
close(IN);

Can I do the same within Python?  Thanks.

Jim


More information about the Tutor mailing list