[Q] ipython: Multiple commands on the same line and newlines
OKB (not okblacke)
brenNOSPAMbarn at NObrenSPAMbarn.net
Sun Apr 17 00:22:38 EDT 2011
Phil Winder wrote:
> Hi,
> I'm having a go at using ipython as a command prompt for data
> analysis. Coming from Matlab, I'm used to typing multiple commands on
> the same line then using the up arrow to go through my history.
> 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.
>
> Also, how can I produce a new line, without it running the command? I
> would have expected a ctrl-enter or shift-enter to produce the
> expected results.
> E.g. I want:
> "x = 0; <ctrl-enter>
> while x < 10: <ctrl-enter>
> x = x + 1; <ctrl-enter>
> " <enter to run>
> It seems to work automatically for the "while xxx:", but combinations
> of keys+enter do not work for "normal" lines.
You might want to take a look at DreamPie (
http://dreampie.sourceforge.net/ ), which provides the second option you
indicate (and thus makesthe first unnecessary). I've found it quite
convenient for interactive use.
--
--OKB (not okblacke)
Brendan Barnwell
"Do not follow where the path may lead. Go, instead, where there is
no path, and leave a trail."
--author unknown
More information about the Python-list
mailing list