In short: This command-line option converts mynotebook.ipynb
to python
code:
jupyter nbconvert mynotebook.ipynb --to python
note: this is different from above answer. ipython
has been renamed to jupyter
. the old executable name (ipython) is deprecated.
More details:
jupyter
command-line has an nbconvert
argument which helps convert notebook files (*.ipynb)
to various other formats.
You could even convert it to any one of these formats using the same command but different --to
option:
the same command jupyter nbconvert --to latex mynotebook.ipynb
For more see jupyter nbconvert --help
. There are extensive options to this. You could even to execute the code first before converting, different log-level options etc.