cd
is the shell command to change the working directory.
How do I change the current working directory in Python?
You can change the working directory with:
import os
os.chdir(path)
There are two best practices to follow when using this method:
Changing the current working directory in a subprocess does not change the current working directory in the parent process. This is true of the Python interpreter as well. You cannot use os.chdir()
to change the CWD of the calling process.