Obtenha WD em 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
print(os.getcwd())
import os
cwd = os.getcwd()
import os
dir_path = os.path.dirname(os.path.realpath(__file__))
import os
#Get Current working Directory
currentDirectory = os.getcwd()
#Change the Current working Directory
os.chdir('/home/varun')
# If by "current working directory" you mean
# the directory in which is saved the script in execution, then:
import os
cwd = os.path.dirname(os.path.realpath(__file__))
print(cwd)