How Do You Get Redirected Input?

not your business not.valid at address.org
Thu Jul 3 02:58:46 EDT 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