Ask Your Question

Revision history [back]

To add another possibility to the list,

%%javascript
var kernel = IPython.notebook.kernel;
var thename = window.document.getElementById("notebook_name").innerHTML;
var command = "theNotebook = " + "'"+thename+"'";
kernel.execute(command);

and print(theNotebook) in a subsequent code cell produces the name of your notebook. But if you are working in a notebook and change its name, then for theNotebook variable to be updated the code containing the javascript magic has to be executed also.

Source: How to I get the current IPython Notebook name.

To add another possibility to the list,

%%javascript
var kernel = IPython.notebook.kernel;
var thename = window.document.getElementById("notebook_name").innerHTML;
var command = "theNotebook = " + "'"+thename+"'";
kernel.execute(command);

and print(theNotebook) in a subsequent code cell produces the name of your notebook. But if

If you are working in a notebook and change its name, then for theNotebook variable to be updated the code containing the javascript magic has to be executed also.

Source: How to I get the current IPython Notebook name.

To add another possibility to the list,

%%javascript
var kernel = IPython.notebook.kernel;
var thename = window.document.getElementById("notebook_name").innerHTML;
var command = "theNotebook = " + "'"+thename+"'";
kernel.execute(command);

and print(theNotebook) in a subsequent code cell produces the name of your notebook.

If you are working in a notebook and change its name, then for theNotebook variable to be updated the code containing the javascript magic has to be executed also.for theNotebook variable to be updated.

Source: How to I get the current IPython Notebook name.