Python 将评论插入 jupyter notebook
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/48869529/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Inserting comments into jupyter notebook
提问by calicationoflife
I hope this is not a redundant question, but I was not able to find a proper answer and tutorial. I am currently learning Data Science and therefore use kaggle competition for practice and jupyter notebook to tackle them (as it is visually more appealing to me). Now I stumbled upon an example kernel (see: http://nbviewer.jupyter.org/github/agconti/kaggle-titanic/blob/master/Titanic.ipynb#Data-Handling) is using comments, links and illustrations between his codes to give more context.
我希望这不是一个多余的问题,但我无法找到正确的答案和教程。我目前正在学习数据科学,因此使用 kaggle 竞赛练习和 jupyter notebook 来解决它们(因为它在视觉上对我更有吸引力)。现在我偶然发现了一个示例内核(参见:http: //nbviewer.jupyter.org/github/agconti/kaggle-titanic/blob/master/Titanic.ipynb#Data-Handling)在他的代码之间使用了注释、链接和插图提供更多背景信息。
Is anybody aware of how to write such comments and remarks within jupyter? If so, do you have an online resource where I could learn this?
有人知道如何在 jupyter 中写出这样的评论和评论吗?如果是这样,您有在线资源可以让我学习吗?
Thanks a bunch!
谢谢一堆!
回答by RSHAP
Yep - highlight a cell and click on the "Cell" dropdown menu and go to "Cell Type" and choose "Markdown". Then you can type any markdowntext you'd like and it will render as such.
是的 - 突出显示一个单元格,然后单击“单元格”下拉菜单,然后转到“单元格类型”并选择“Markdown”。然后你可以输入任何你想要的Markdown文本,它会呈现这样的效果。
^^ Also there are shortcutsfor changing cell types as well. Highlight a cell and press the esc
key to change into "command" mode and press m
. This changes it to a markdown cell. Press y
to change it back to a code cell.
^^ 也有更改单元格类型的快捷方式。突出显示一个单元格并按esc
键更改为“命令”模式,然后按m
。这将其更改为降价单元格。按y
将其改回代码单元格。
You can also do latex equations using dollar signs ($). There is documentation for this here
您还可以使用美元符号 ($) 进行乳胶方程。有这方面的文档here
回答by dgruending
For markdown cells
对于降价单元格
[//]: # "Your comment in here."
allows to include a comment in jupyter notebook server version 6.0.1. See this discussionfor more details on markdown comments.
允许在 jupyter notebook 服务器版本 6.0.1 中包含注释。有关降价评论的更多详细信息,请参阅此讨论。