How Do You Get Redirected Input?

Cliff Wells LogiplexSoftware at earthlink.net
Thu Jul 3 01:17:08 CEST 2003


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"


-- 
Cliff Wells, Software Engineer
Logiplex Corporation (www.logiplex.net)
(503) 978-6726  (800) 735-0555






More information about the Python-list mailing list