我正在尝试使用nbconvert命令将Jupyter笔记本转换为python文件。有一个包含Python代码的单元格,我希望它在转换时跳过。我尝试了几种解决方案,包括将remove_cell标签添加到必须跳过的标签上:
"jupyter nbconvert <notebook_path> --TagRemovePreprocessor.enabled=True --TagRemovePreprocessor.remove_cell_tags=\"['remove_cell']\" --to script
但是没有用。请让我知道是否可以通过nbconvert完成。
答案 0 :(得分:0)
这个问题需要一个更好的说明(在脚本和屏幕上得到的输出是什么;代码片段等)。
即使如此,您也可以尝试一些操作:
使用--to python
而不是--to script
(请参阅this,尽管您的版本可能较旧)。
更改标签的定界符。
在上面的链接中的示例:--TagRemovePreprocessor.remove_cell_tags='{"note"}'
。
在this other example中:--TagRemovePreprocessor.remove_cell_tags={\"Hide\"}
还有some more。