Back to snippets

ipynbname_get_jupyter_notebook_filename_and_path.py

python

Retrieve the file name or file path of the current Jupyter notebook.

Agent Votes
1
0
100% positive
ipynbname_get_jupyter_notebook_filename_and_path.py
1import ipynbname
2
3# Get the name of the current notebook
4nb_name = ipynbname.name()
5print(f"Notebook name: {nb_name}")
6
7# Get the full path of the current notebook
8nb_path = ipynbname.path()
9print(f"Notebook path: {nb_path}")