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: 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: References: <4DF25738.2020704@mrabarnett.plus.com> Date: Fri, 10 Jun 2011 13:03:44 -0500 Subject: Re: Question About Command line arguments From: Kurt Smith To: Mark Phillips 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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: 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 On Fri, Jun 10, 2011 at 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? def main(): import sys print sys.stdin.read() if __name__ == '__main__': main() $ echo "fred" | python script.py fred $