Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

convert json ipython notebook(.ipynb) to .py file

How do you convert an IPython notebook file (json with .ipynb extension) into a regular .py module?

like image 281
Nitesh Selkari Avatar asked Jun 13 '16 19:06

Nitesh Selkari


People also ask

How do I change my Jupyter Notebook to Ipynb to py?

Open the jupyter notebook that you want to convert. Navigate into the 'File' menu and select 'Download as'. The more options will be displayed in the form of a list where you will click on the 'Python (. py)' option.

How do I save a Jupyter Notebook as a .py file?

There is a disk icon in the upper left of the Jupyter tool bar. Click the save icon and your notebook edits are saved.

Is .ipynb file a Python file?

The Jupyter Notebook was formerly named IPython Notebook. The extension *. ipynb is from letters IPython Notebook. The IPython was developed as a command shell for interactive computing in Python programming language.


1 Answers

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.

enter image description here

Another option would be to use nbconvert from the command line:

jupyter nbconvert --to script 'my-notebook.ipynb' 

Have a look here.

like image 165
kikocorreoso Avatar answered Sep 23 '22 02:09

kikocorreoso