save a juptyer notebook with specific name within

2019-07-21 10:42发布

问题:

I have a Jupyter notebook that is more or a less a 'template' of how things are done. For example the notebook is a template of say each country's economic data. All of the plots, and analysis is standardized.

I'm looking for a way to have this saving done in a coded way rather than manually naming it myself. Is there anyway so that if I have a variable labeled as:

  my_assignment = 'india'

I could save the notebook name as

  file_name =   my_assignment + todays_date

 save(file_name)

I code in python.

回答1:

You may have to jump to %%javascript to interact with Jupyter, which is different to the ipython kernel that the python code is sent to, e.g.:

%%javascript
Jupyter.notebook.copy_notebook()

Not sure you can copy with a specific name.
You can programmaticly rename the current notebook with:

Jupyter.notebook.rename(<new_name>)