将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屋!
查看全文