How Do You Get Redirected Input?

not your business not.valid at
Thu Jul 3 08:58:46 CEST 2003

Cliff Wells wrote:

> On Wed, 2003-07-02 at 12:10, not your business wrote:
>> I have a shell tool that accepts arguments on the command line. I would
>> like
>> to check if the input is being piped in.  That is,
> import sys
> if sys.stdin.isatty():
>     print "not piped in"
> else:
>     print "piped in"
Excellent, sir.  Thank you very much.

More information about the Python-list mailing list