ipython: Multiple commands on the same line and newlines

Rajendra prasad Gottipati rajendra4linux at gmail.com
Sun Apr 17 16:07:31 EDT 2011


Phil,

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 ;
done')
>>> print o
1
2
3
4
5
6
7
8
9
10
>>>

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!
>
> Cheers,
> Phil
> --
> http://mail.python.org/mailman/listinfo/python-list
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20110417/95af7c5e/attachment-0001.html>


More information about the Python-list mailing list