Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!us.feeder.erje.net!newsfeed.straub-nv.de!newsreader4.netcologne.de!news.netcologne.de!newsfeed.freenet.ag!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!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.002 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; '16,': 0.03; 'error:': 0.05; 'valueerror:': 0.07; 'script,': 0.09; 'throws': 0.09; 'unpack': 0.09; 'valueerror': 0.09; 'cc:addr:python-list': 0.10; 'subject:whitespaces': 0.16; 'input': 0.18; 'skip:" 30': 0.20; 'cc:2**0': 0.23; 'cc:no real name:2**0': 0.24; 'cc:addr:python.org': 0.25; 'header:In-Reply-To:1': 0.25; '(most': 0.27; 'right.': 0.27; 'message-id:@mail.gmail.com': 0.27; 'methods.': 0.29; 'file': 0.32; 'traceback': 0.33; 'received:google.com': 0.34; 'subject:?': 0.35; 'received:209.85': 0.35; 'something': 0.35; 'received:209': 0.37; 'subject:: ': 0.38; 'mean': 0.38; 'takes': 0.39; 'more': 0.63; 'subject:Any': 0.84 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:in-reply-to:references:date:message-id :subject:from:to:cc:content-type; bh=1jzYJxDxv2ToC103tFn/OoyEFtLZOFTZfg0QsbZjvxg=; b=IZ8UblZUs7zR41p78/YX3AgpQTHzO0bTGlQmfPs3hMXFvf+jgkTMgWVq4GpRz5LxQT PUfJMoTzDFMWX+qIiaJLpAs7ZsasHgcR2s3s+JR39e+mymKfSqDXi4b7STHpvypgBbgv 0tP4qvs8TNJzRegn5bmAzdrz0abA8dfhp1IsRYtmEaJZ3oJ+L9Nb2eztDLZVMcxQ8Zdd hJcAvpM71waQ8vBGxWfvxxUhM2WI0y/fPCzuS6zQTEwmoiTLzcYHDVPwn8M/DH6pVtT0 RvqH7uLZuSpSq3hHfoFDiBu2qOahxp1LnwDdEjNiHPU0IohyYN914S6zimB6iCc21jM9 rYnA== MIME-Version: 1.0 X-Received: by 10.182.123.49 with SMTP id lx17mr1188005obb.63.1358953015147; Wed, 23 Jan 2013 06:56:55 -0800 (PST) In-Reply-To: <50FFBCC5.5020506@davea.name> References: <50FAEE23.5030107@lightbird.net> <50FFBCC5.5020506@davea.name> Date: Wed, 23 Jan 2013 20:26:55 +0530 Subject: Re: Any algorithm to preserve whitespaces? From: Santosh Kumar To: Dave Angel Content-Type: text/plain; charset=UTF-8 Cc: python-list@python.org X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 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: 18 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1358953018 news.xs4all.nl 6906 [2001:888:2000:d::a6]:40234 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:37477 Yes, Peter got it right. Now, how can I replace: script, givenfile = argv with something better that takes argv[1] as input file as well as reads input from stdin. By input from stdin, I mean that currently when I do `cat foo.txt | capitalizr` it throws a ValueError error: Traceback (most recent call last): File "/home/santosh/bin/capitalizr", line 16, in script, givenfile = argv ValueError: need more than 1 value to unpack I want both input methods.