Question
In Python, what commands can I use to find:
How-To
To get the full path to the directory a Python file is contained in, write this in that file:
- import os
- dir_path = os.path.dirname(os.path.realpath(__file__))
- import os
- cwd = os.getcwd()
Supplement
* Python 獲取文件路徑及文件目錄(__file__ 的使用方法)
沒有留言:
張貼留言