Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #7393

Re: Question About Command line arguments

Date 2011-06-10 13:31 -0500
From Tim Chase <python.list@tim.thechases.com>
Subject Re: Question About Command line arguments
References <BANLkTi==QHd+5C=xf+2Re1Mh4V6Hk972hg@mail.gmail.com> <4DF25738.2020704@mrabarnett.plus.com> <BANLkTimHfZK=FsbSs4BOX8dU=mt2bVGV9A@mail.gmail.com>
Newsgroups comp.lang.python
Message-ID <mailman.93.1307730688.11593.python-list@python.org> (permalink)

Show all headers | View raw


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


Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Re: Question About Command line arguments Tim Chase <python.list@tim.thechases.com> - 2011-06-10 13:31 -0500

csiph-web