How to write a cell magic that knows the input number of the cell?

前端 未结 1 1157
小鲜肉
小鲜肉 2021-01-26 05:16

Is there a way to write a cell magic that knows the input number of the cell? By \"input number\" I mean the ? in the cell\'s In[?] prefix. At first gl

相关标签:
1条回答
  • 2021-01-26 05:30

    This information is provided by the execution_count of the current instance of the IPython shell, that can be obtained with get_ipython:

    print(get_ipython().execution_count)
    
    0 讨论(0)
提交回复
热议问题