In ipython, we can use
_ih[32:39]
To show history lines between 32 and 39. How can I directly execute these history lines?
Use the exec statement:
exec
exec(_ih[32:39])
http://docs.python.org/reference/simple_stmts.html#exec