[Q] ipython: Multiple commands on the same line and newlines

wisecracker at tesco.net wisecracker at tesco.net
Sat Apr 16 15:17:35 EDT 2011


Hi Phil...

> How can I write multiple python commands on the same line?
> E.g. "x = 0; while x < 10: x = x + 1;" returns an "invalid syntax"
> error on the 'e' in while.

I don`t think this is possible under any Python version.

There will always be some kind of user intervention required other than
just the single 1, (one), <RETURN/ENTER>

E.G...

>>> x = 0<RETURN/ENTER>
>>> while x < 10: print x; x = x + 1<RETURN/ENTER>
...<RETURN/ENTER>
0
1
2
3
4
5
6
7
8
9
>>> <FLASHING_CURSOR>

Ending up with two, (2), lines and three, (3), <RETURN/ENTER>

I hope some one can prove me wrong because I would love single line ability sometimes.



--
73...

Bazza, G0LCU...

Team AMIGA...

http://homepages.tesco.net/wisecracker/

http://main.aminet.net/search?readme=wisecracker

http://mikeos.berlios.de/




More information about the Python-list mailing list