将 json ipython notebook(.ipynb) 转换为 .py 文件 [英] convert json ipython notebook(.ipynb) to .py file
本文介绍了将 json ipython notebook(.ipynb) 转换为 .py 文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何将 IPython 笔记本文件(带有 .ipynb
扩展名的 json)转换为常规的 .py
模块?
How do you convert an IPython notebook file (json with .ipynb
extension) into a regular .py
module?
推荐答案
从笔记本菜单中,您可以将文件直接保存为 python 脚本.转到菜单的文件"选项,然后选择下载为",然后您会看到Python (.py)"选项.
From the notebook menu you can save the file directly as a python script. Go to the 'File' option of the menu, then select 'Download as' and there you would see a 'Python (.py)' option.
另一种选择是从命令行使用 nbconvert:
Another option would be to use nbconvert from the command line:
jupyter nbconvert --to script 'my-notebook.ipynb'
查看此处.
这篇关于将 json ipython notebook(.ipynb) 转换为 .py 文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文