Question About Command line arguments

Tim Chase python.list at tim.thechases.com
Fri Jun 10 14:31:19 EDT 2011


On 06/10/2011 12:58 PM, Mark Phillips wrote:
> How do I write my script so it picks up argument from the
> output of commands that pipe input into my script?

You can check

   if os.isatty(sys.stdin):  # <-- this check
     do_stuff_with_the_terminal()
   else:
     read_options_from_stdin()

-tkc






More information about the Python-list mailing list