[Tutor] Python Pipes

eryksun eryksun at gmail.com
Mon Oct 29 16:25:20 CET 2012


On Mon, Oct 29, 2012 at 6:33 AM, Ganesh Manal <manalganesh at gmail.com> wrote:
>
> Please give me sample python program that works with python31

Re: Python Pipes

If you're looking to pipe data to, from, and between processes, look
at the subprocess module:

http://docs.python.org/release/3.1/library/subprocess

If you want something specific to a Unix shell, look at the pipes module:

http://docs.python.org/release/3.1/library/pipes

If you want your own program to behave differently when stdin/stdout
are piped, use isatty():

    >>> import sys
    >>> sys.stdin.isatty()
    True
    >>> sys.stdout.isatty()
    True

http://docs.python.org/release/3.1/library/io#io.IOBase.isatty


More information about the Tutor mailing list