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


Groups > comp.lang.python > #7391

Re: Question About Command line arguments

Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!selfless.tophat.at!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <kwmsmith@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.000
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'received:209.85.212.46': 0.03; 'received:mail-vw0-f46.google.com': 0.03; 'main()': 0.05; 'sys': 0.05; 'python': 0.08; '__name__': 0.09; 'fred': 0.09; 'pm,': 0.10; 'output': 0.11; 'def': 0.12; 'wrote:': 0.14; "'__main__':": 0.16; 'main():': 0.16; 'phillips': 0.16; 'picks': 0.16; 'argument': 0.16; 'input': 0.17; 'cc:addr:python-list': 0.17; 'header:In-Reply-To:1': 0.21; 'cc:2**0': 0.22; 'cc:no real name:2**0': 0.23; 'fri,': 0.23; 'subject:Question': 0.25; 'script': 0.27; 'message-id:@mail.gmail.com': 0.28; 'import': 0.29; 'cc:addr:python.org': 0.30; 'print': 0.31; 'received:209.85.212': 0.34; 'received:google.com': 0.37; 'received:209.85': 0.37; 'subject:: ': 0.38; 'received:209': 0.39; 'subject:About': 0.68; 'subject:line': 0.73
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=XXxZdrQkJ4bfEOF6qWtQOhUzpl+vQJaHc8RLySPGCDs=; b=q3QL4tMUtcoz/2a41OUDniqaWB+HZo3DGoqThyaku4BPwjVkASyTs07VyO1k+rNGfS CYaJaYw5V/hxbFxvBIxBF42x/NFKasi62BHpggEETU0dZVNAXRCubORK+HIYcqjHOb3s aZzcSn5YHobQxHytPhys1h0u+wFt/vAmckGIY=
DomainKey-Signature a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; b=LqG58YYAtnuB+Al2/xpsjJtih6wfO9DXwpXovkVh7Z3uRfWCyZP/5LNjJkwkM49sF0 SiB3BPGy1+SCkEJRpnNSXAl47ivlxjfOhGgX1G05yPlh2O2Q3Bt9kWe06lAlleAnhH9R a6MwzItd1uI15T/7UmShcx+vIvEjqbbW+KLb4=
MIME-Version 1.0
In-Reply-To <BANLkTimHfZK=FsbSs4BOX8dU=mt2bVGV9A@mail.gmail.com>
References <BANLkTi==QHd+5C=xf+2Re1Mh4V6Hk972hg@mail.gmail.com> <4DF25738.2020704@mrabarnett.plus.com> <BANLkTimHfZK=FsbSs4BOX8dU=mt2bVGV9A@mail.gmail.com>
Date Fri, 10 Jun 2011 13:03:44 -0500
Subject Re: Question About Command line arguments
From Kurt Smith <kwmsmith@gmail.com>
To Mark Phillips <mark@phillipsmarketing.biz>
Content-Type text/plain; charset=ISO-8859-1
Cc python-list@python.org
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.12
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.91.1307729033.11593.python-list@python.org> (permalink)
Lines 15
NNTP-Posting-Host 82.94.164.166
X-Trace 1307729034 news.xs4all.nl 49181 [::ffff:82.94.164.166]:33880
X-Complaints-To abuse@xs4all.nl
Xref x330-a1.tempe.blueboxinc.net comp.lang.python:7391

Show key headers only | 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