Re: for-loop on cmd-line

Discussion in 'Python' started by Gisle Vanem, Oct 11, 2012.

  1. Gisle Vanem

    Gisle Vanem Guest

    "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
     
    Gisle Vanem, Oct 11, 2012
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Achim Domma (Procoders)

    read input for cmd.Cmd from file

    Achim Domma (Procoders), Jun 3, 2005, in forum: Python
    Replies:
    2
    Views:
    8,135
    Peter Otten
    Jun 3, 2005
  2. Sarir Khamsi

    Interpreter-like help in cmd.Cmd

    Sarir Khamsi, Jun 9, 2005, in forum: Python
    Replies:
    4
    Views:
    400
    Bengt Richter
    Jun 26, 2005
  3. =?ISO-8859-1?Q?Sch=FCle_Daniel?=

    [exec cmd for cmd in cmds]

    =?ISO-8859-1?Q?Sch=FCle_Daniel?=, Mar 8, 2006, in forum: Python
    Replies:
    3
    Views:
    417
    Scott David Daniels
    Mar 8, 2006
  4. Diez B. Roggisch

    pydb remote debugging/cmd.Cmd over socket?

    Diez B. Roggisch, May 28, 2008, in forum: Python
    Replies:
    2
    Views:
    578
    Diez B. Roggisch
    May 29, 2008
  5. Isaac Won
    Replies:
    9
    Views:
    458
    Ulrich Eckhardt
    Mar 4, 2013
Loading...

Share This Page