ipython how to execute several history lines

前端 未结 7 1526
梦谈多话
梦谈多话 2021-01-30 14:04

In ipython, we can use

_ih[32:39] 

To show history lines between 32 and 39. How can I directly execute these history lines?

相关标签:
7条回答
  • 2021-01-30 14:57

    I use the list notation:

    exec In[34:36]
    

    also, if you use the edit function to edit a chunk, the Out list will have your code in it, so:

    exec Out[35]
    

    And my favorite:

    edit In[34:38]
    

    because I am a fat-fingered slob who can rarely get it right on the first try.

    0 讨论(0)
提交回复
热议问题