I have a problem when the output from a notebook is really long and it's saved into the notebook, any time I want to open this particular notebook again the browser crashes and can't display correctly.
To fix this I have to open it with a text editor and delete all output from that cell causing the problem.
I wonder if there is a way to clean all output from the notebook so one can open it again without problem. I want to delete all output since deleting a specific one seems more troublesome.
--ClearOutputPreprocessor.enabled=True
There is now a built-in command line option to do it:
Or to another file called
NotebookNoOut.ipynb
:jupyter nbconvert --help
also documents a--clear-output
option, but for some reason it did not work.Tested in Jupyter 4.4.0, notebook==5.7.6.
Use clean_ipynb, which not only clears notebook output but can also clean the code.
Install by
pip install clean_ipynb
Run by
clean_ipynb hello.ipynb
Use --ClearOutputPreprocessor.enabled=True and --clear-output
Following this command:
jupyter nbconvert --ClearOutputPreprocessor.enabled=True --clear-output *.ipynb