Ipython Notebook:关闭部分单元格的优雅方法? [英] Ipython Notebook: Elegant way of turning off part of cells?

查看:164
本文介绍了Ipython Notebook:关闭部分单元格的优雅方法?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的ipython notebook中,有一部分单元格用作初步检查.

In my ipython notebook, there is part of cells that serves as preliminary inspection.

现在我要turn it off,因为运行它后,我知道数据集的状态,但是我也想保留它,因此使用此笔记本的其他人可以具有此功能.

Now I want to turn it off, since after running it I know the status of the dataset, but I also want to keep it, so other people using this notebook can have this functionality.

我该怎么办?有这样做的例子吗?

How can I do it? Is there any example of doing it?

  1. 我可以comment out这些单元格,但是随后在onoff之间切换会非常费力.也许对其他人来说并不那么令人信服.

  1. I can comment out these cells, but then switching between on and off would be quite laborious. And may not be quite convinent for other people.

我可以将其抽象为function,但是它本身具有一些方法,因此代码将非常复杂,并且可能难以阅读?

I can abstract it into a function, but that itself has some methods, so the code would be quite convoluted, and may be hard to read?

推荐答案

使用Jupyter笔记本,您可以单击一个单元格,依次按escr.将其转换为原始"单元格.可以执行类似的操作将其转换回esc + y.无需评论,只需按一下键即可.

Using Jupyter notebook you can click on a cell, press esc and then r. That converts it to a "raw" cell. Similar thing can be done to convert it back, esc + y. No comments needed, just key presses.

在Juptyer笔记本中,转到帮助->键盘快捷键以获取更多信息.

Within Juptyer notebook, go to Help -> Keyboard shortcuts for more.

这是一个片段:

命令模式(按Esc启用)

  • ↩:进入编辑模式

  • ↩ : enter edit mode

⇧↩:运行单元格,在下面选择

⇧↩ : run cell, select below

⌃↩:运行单元格

⌥↩:运行单元格,在下方插入

⌥↩ : run cell, insert below

y:进行编码

m:降价

r:原始

这篇关于Ipython Notebook:关闭部分单元格的优雅方法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆