是否可以使用 jupyter Notebook 中的代码添加单元格或删除单元格?
是否可以使用代码在jupyter笔记本中添加或删除单元格?
例如:我们可以使用 10 范围内的 for 循环来创建 10 个单元格并可能在其中执行某些操作吗?
is it possible to use code to add or delete cells in jupyter notebook?
For example: can we use a for loop in range of 10 that creates 10 cells and perhaps executes something in it ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
大部分代码在此 GitHub 问题的讨论中提供。
您可以使用以下代码以编程方式在当前单元格下方附加 10 个新代码单元格。
如果您想执行其中一个或全部,可以使用以下代码。
上面的代码将执行笔记本中的第三个单元格。您可以循环遍历要执行的索引。
Most of the code is provided in a discussion in this GitHub issue.
You could use the following code to programmatically append 10 new code cells below the current cell.
If you want to execute one, or possibly all of them, you could use the following code.
The above will execute the third cell in the notebook. You could loop over the indices that you want to execute.