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.

Try experimenting with a standard program, to see what can be combined
and what cannot.

You can do it easily enough with a list comprehension. Let us know if
you can't work that out.

By the way, much cleaner than defining your own counting variable is to
use enumerate().

Any reason why you don't just make a one-file python script, and run
that instead of your one line batch file? Or is this line one of many
in the batch file?

Share This Page

Welcome to The Coding Forums!

Welcome to the Coding Forums, the place to chat about anything related to programming and coding languages.

Please join our friendly community by clicking the button below - it only takes a few seconds and is totally free. You'll be able to ask questions about coding or chat with the community and help others.
Sign up now!