【发布时间】:2020-05-18 16:19:19
【问题描述】:
我想要一个可以在 jupyter notebook 中重启内核的功能。如果我单独使用下面的 HTML 语句,它可以很好地工作,但在函数中它不会:
from IPython.core.display import HTML
def restart_kernel():
HTML('<script>IPython.notebook.kernel.restart();IPython.notebook.execute_all_cells()</script>')
仅当我在没有任何其他代码的单元格中使用它时才有效:
HTML('<script>IPython.notebook.kernel.restart();IPython.notebook.execute_all_cells()</script>')
这是为什么呢?我该如何解决这个问题?
提前致谢, 罗兰
【问题讨论】:
-
我认为this 会有所帮助。如果没有,我可以在此基础上添加一个可能有帮助的答案。
标签: python html request jupyter