How to set the current working directory? [duplicate] How to set the current working directory? [duplicate] python python

How to set the current working directory? [duplicate]


Try os.chdir

os.chdir(path)

        Change the current working directory to path. Availability: Unix, Windows.


Perhaps this is what you are looking for:

import osos.chdir(default_path)


import osprint os.getcwd()  # Prints the current working directory

To set the working directory:

os.chdir('c:\\Users\\uname\\desktop\\python')  # Provide the new path here