[Tutor] opening a pipe?

Poor Yorick org.python.tutor at pooryorick.com
Tue Feb 12 19:48:45 CET 2008

>  From: James Hartley <>
>  Subject: [Tutor] opening a pipe?
>  Sent: 2008-02-12 09:24
>  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.

os.popen can do this.  The 'commands' module provides even more flexibility.  If you are on a posix platform and want to avoid shell interpretation, you could also try my pipeline package at 


"Our servers are using too much electricity.  We need to virtualize."

More information about the Tutor mailing list