Path: csiph.com!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder1.enfer-du-nord.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed6.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.001 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'python.': 0.02; 'win32': 0.03; 'lines,': 0.05; 'parsing': 0.07; 'python': 0.09; 'if,': 0.09; 'restriction': 0.09; 'script,': 0.09; 'to:name:python-list': 0.15; 'for,': 0.16; 'looping': 0.16; 'semicolon': 0.16; 'statements,': 0.16; 'wrote:': 0.17; 'restrictions': 0.17; 'x-mailer:microsoft outlook express 6.00.2900.5931': 0.22; 'command': 0.24; 'guess': 0.27; 'first.': 0.27; "doesn't": 0.28; 'all.': 0.28; 'run': 0.28; "i'm": 0.29; 'that.': 0.30; 'to:addr :python-list': 0.33; "can't": 0.34; 'list': 0.35; 'something': 0.35; 'there': 0.35; 'thank': 0.36; 'charset:us-ascii': 0.36; 'enough': 0.36; 'ok,': 0.37; 'being': 0.37; 'why': 0.37; 'subject:: ': 0.38; 'nothing': 0.38; 'several': 0.39; 'instead': 0.39; 'to:addr:python.org': 0.39; 'easily': 0.39; 'subject:-': 0.40; 'your': 0.60; 'surface': 0.84; 'suspected': 0.84 MIME-version: 1.0 Content-transfer-encoding: 7BIT Content-type: text/plain; CHARSET=US-ASCII; format=flowed; reply-type=original From: Gisle Vanem To: Python-list References: <5076B379.4010503@davea.name> Subject: Re: for-loop on cmd-line Date: Thu, 11 Oct 2012 15:40:57 +0200 X-Priority: 3 X-MSMail-priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2900.5931 X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.2900.6157 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: 24 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1349962873 news.xs4all.nl 6872 [2001:888:2000:d::a6]:54084 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:31119 "Dave Angel" wrote: > it has nothing to do with being on a command line. You're using > semicolon to combine several statements, and there are restrictions on > what can be combined that way. One restriction is the looping > constructs, for, if, while. Ok, I suspected something like that. > You can do it easily enough with a list comprehension. Let us know if > you can't work that out. Later. I'm only scratching the surface of Python. > Any reason why you don't just make a one-file python script, and run > that instead of your one line batch file? I though of calling that python line from a C-program using popen() and parsing the output. Since popen() on Win32 AFAIK doesn't accept multiple lines, I guess I must write a .py-file to %TEMP first. Thank to all. --gv