Save html of a Jupyter notebook from within the notebook

空扰寡人 提交于 2021-01-27 06:34:33

问题


My Jupyter workflow for exploratory analysis looks like:

  1. Fiddle with some parameters.
  2. Run the notebook; generate output.
  3. Eyeball outputs.
  4. Repeat.

Can anyone suggest a command to make the notebook to save a copy of itself (e.g as an html in the output folder), so that if I want to recreate a particular experiment (results from a particular parameter set) I can do so?


回答1:


Yes you can. Just add a safe cell by using cell magic. After using nbconvert you can rename the file and append a date

%%bash
jupyter nbconvert --to html MyNotebookName.ipynb
mv MyNotebookName.html $(date +"%m_%d_%Y-%H%M%S")_MyNotebookName.html


来源:https://stackoverflow.com/questions/38540326/save-html-of-a-jupyter-notebook-from-within-the-notebook

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!