Hello everyone,
Is there a way to save all the code created in a Notebook as a Python file?
Thanks
Notebook files get created when you save a project. They usually have a name like "New Notebook" with a number after them.
From a command shell, you should be able to run conda to activate an environment then use the jupyter command, like this (On my installation, conda is in "C:\Program Files\ArcGIS\Pro\bin\Python\Scripts\")
conda activate arcgispro-py3 jupyter nbconvert "New Notebook.ipynb" --to script
This wrote a file called "New Notebook.ipynb" with the contents of each cell from the notebook. In my simple case, it's this
print("Hello")
Hi
When you select the notebook tab you have the option to export to Python script.
Have fun
Signed in members can post, follow updates, and more. New here? Register a free account.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.