Obtenez WD dans Python
import os
path = os.getcwd()
print(path)
# /Users/mbp/Documents/my-project/python-snippets/notebook
print(type(path))
# <class 'str'>
Happy Hawk
import os
path = os.getcwd()
print(path)
# /Users/mbp/Documents/my-project/python-snippets/notebook
print(type(path))
# <class 'str'>
import os
dir_path = os.path.dirname(os.path.realpath(__file__))
import os
os.getcwd()
import os
#full path
dir_path = os.path.dirname(os.path.realpath(__file__))
#current dir
cwd = os.getcwd()
# print current working directory in python
import os
cwd = os.getcwd()
print(cwd)
import os
print(os.path.abspath(''))