[IPython-user] repeat multiple command

Ville Vainio vivainio at gmail.com
Fri Mar 17 18:30:53 CST 2006


On 3/17/06, John Hunter <jdhunter at ace.bsd.uchicago.edu> wrote:

> and realize, oops, I forgot to define "big".  So the I want to do
>
> In [37]: big = []
>
> and then rerun all the lines from In[36] .
>
> Magic incantation?

The svn version supports:

_ip.runlines(_ih[37])

If there was multiple lines something like

_ip.runlines(_ih[37:39])

would also work.


[ipython]|33> _ip.runlines?
Type:           instancemethod
Base Class:     <type 'instancemethod'>
String Form:    <bound method IPApi.runlines of <IPython.ipapi.IPApi instance at
 0x00C34C60>>
Namespace:      Python builtin
File:           f:\prj\ipython\ipython\ipapi.py
Definition:     _ip.runlines(self, lines)
Docstring:
    Run the specified lines in interpreter, honoring ipython directives.

This allows %magic and !shell escape notations.

Takes either all lines in one string or list of lines.

--
Ville Vainio - vivainio.googlepages.com
vainio.blogspot.com - g[mail | talk]='vivainio'




More information about the IPython-user mailing list