Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to save python script as .py file on jupyter notebook

I wrote some functions on Jupyter notebook and want to save the script in form of .py, but anaconda jupyter notebook automatically saves the script as .ipynb, How can I change it to .py for this specific script? Is there any command for it? Thanks

like image 500
MayOJ Avatar asked Oct 19 '18 04:10

MayOJ


People also ask

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.

How do I save Python code as py?

Right-click the Python window and select Save As to save your code either as a Python file (. py) or Text file (. txt). If saving to a Python file, only the Python code will be saved.

How do I save a .py file in Jupyterlab?

In Jupyter lab, go to File Menu. Select "Export Notebook as" and then choose the "Export Notebook to Executable Script" option. For Jupyter notebook, there is "Download as" option in File menu of Jupyter notebook.


1 Answers

You can download a copy of the python as a .py script from FILE menu in the upper left corner. See this photograph.enter image description here

That should do it!

like image 92
sconfluentus Avatar answered Oct 03 '22 09:10

sconfluentus