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


Groups > comp.lang.python > #7391

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>
Date 2011-06-10 13:03 -0500
Subject Re: Question About Command line arguments
From Kurt Smith <kwmsmith@gmail.com>
Newsgroups comp.lang.python
Message-ID <mailman.91.1307729033.11593.python-list@python.org> (permalink)

Show all headers | View raw


On Fri, Jun 10, 2011 at 12:58 PM, Mark Phillips
<mark@phillipsmarketing.biz> wrote:
> How do I write my script so it picks up argument from the output of commands
> that pipe input into my script?

def main():
    import sys
    print sys.stdin.read()

if __name__ == '__main__':
    main()

$ echo "fred" | python script.py
fred
$

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


Thread

Re: Question About Command line arguments Kurt Smith <kwmsmith@gmail.com> - 2011-06-10 13:03 -0500
  Re: Question About Command line arguments Hans Mulder <hansmu@xs4all.nl> - 2011-06-11 00:03 +0200

csiph-web