Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I save .py files in IPython notebook with the .ipynb files

How do I set my IPython Notebook so that whenever I save the .ipynb file it will also automatically save the file as a .py file (in the same directory)?

In particular every time I make a change to a notebook I don't want to have to download the file as a .py file and then move the downloaded file into the directory.

I recently moved to a Mac and was able to do this on my previous (PC) setup, but haven't been able to find how to explicitly set IPython to do this.

like image 447
Nate Ackerman Avatar asked Dec 19 '13 19:12

Nate Ackerman


People also ask

How do I save Ipynb as py in jupyter notebook?

ipynb) to python (. py) is using the Jupyter GUI environment. Open the jupyter notebook that you want to convert. Navigate into the 'File' menu and select 'Download as'.

How do I save a .py file in jupyter notebook?

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


1 Answers

You can start the notebook server with a --script flag, or set this variable to True in the file ipython_notebook_config.py:

c.FileNotebookManager.save_script = True
like image 140
Thomas K Avatar answered Sep 21 '22 14:09

Thomas K