ipython: Multiple commands on the same line and newlines
Rajendra prasad Gottipati
rajendra4linux at gmail.com
Sun Apr 17 22:07:31 CEST 2011
there is one more way you can run all commands as in linux shell..
>>> import commands
>>> s, o = commands.getstatusoutput('x=10;for i in $(seq $x); do echo $i ;
>>> print o
On Sun, Apr 17, 2011 at 11:40 AM, Phil Winder <philipwinder at gmail.com>wrote:
> On Apr 17, 1:11 pm, Andrea Crotti <andrea.crott... at gmail.com> wrote:
> > Phil Winder <philipwin... at gmail.com> writes:
> > > Yes, that does not produce an error, but it does not "work". Please
> > > refer to my first post. Try the first code, you will get a syntax
> > > error. Placing things on one line makes for easy history scrollback.
> > > In your version you will have 2 lines of history for the x = 0 term
> > > and the while ... term. I don't want to have to press up twice,
> > > especially when the code was in the distant past! Also cpaste might be
> > > ok for scripting, but it looks too clumsy to use at the command line.
> > > Cheers,
> > > Phil
> > Well I guess that's the way it is with the interpreter..
> > But I don't see the sense in doing everything from there, just write the
> > code to a file and use %edit from ipython to change and run it, it's
> > quite nice and easy too.
> Ok, thanks all. It's a little disappointing, but I guess that you
> always have to work in a different way when you move to a new
> language. Andrea's %edit method is probably the best compromise, but
> this now means that I will have to learn all the (obscure) shortcuts
> for vi!
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Python-list