0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

VSCode の Jupyter Notebook で実行中の ipynb ファイルのファイル名を取得する

Last updated at Posted at 2024-12-27

はじめに

前に調べてすっかり忘れてしまっていたので備忘録として残します.
ググっても情報がほとんどないので,以前の自分はどうやって調べたのか不明すぎる.

方法

たったこれだけ.

print(__vsc_ipynb_file__)
# >>> home/path/to/file.ipynb # linux は homeからのパス
# >>> c:\Users\username\path\to\file.ipynb # Windows はcドライブからの絶対パス

なお string オブジェクトです.

print(type(run_file))
# >>> <class 'str'>

参考文献

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?