import os dirpath = os.getcwd() print(dirpath)
Output
D:\PythonProjects\tips and tricks>
Note: To change the working directory use chdir() method of os library as os.chdir(r’your directory path’)