Reading Time: 1 minutes
Current Directory in Python
In order to check the current directory in Python, you can use the getcwd() function of the standard library os.
current directory
import os print( os.getcwd() )
To change the current directory, use the chdir() function.
import os os.chdir(path) # e.g. os.chdir(r'C:\Users\')