[IPython-user] repeat multiple command

John Hunter jdhunter at ace.bsd.uchicago.edu
Fri Mar 17 15:51:47 CST 2006



Suppose I type a multiline command in ipython and want to reexecute
the batch.  Eg,


In [36]: for i in range(4):
   ....:     if i>1:
   ....:         big.append(i)
   ....:
------------------------------------------------------------
Traceback (most recent call last):
  File "<ipython console>", line 3, in ?
NameError: name 'big' is not defined

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?

JDH




More information about the IPython-user mailing list