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


Groups > comp.lang.python > #31119

Re: for-loop on cmd-line

From Gisle Vanem <gvanem@broadpark.no>
References <E7295A9F2EFF4FD0A64C1225370AAC56@dev.null> <5076B379.4010503@davea.name>
Subject Re: for-loop on cmd-line
Date 2012-10-11 15:40 +0200
Newsgroups comp.lang.python
Message-ID <mailman.2051.1349962873.27098.python-list@python.org> (permalink)

Show all headers | View raw


"Dave Angel" <d@davea.name> 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

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


Thread

Re: for-loop on cmd-line Gisle Vanem <gvanem@broadpark.no> - 2012-10-11 15:40 +0200

csiph-web