How to set the current working directory in Python?

PythonServer Side ProgrammingProgramming

You can change directory or cd in Python using the os module. It takes as input the relative/absolute path of the directory you want to switch to.

For example

>>> import os
>>> os.chdir('my_folder')
Published on 22-Dec-2017 14:22:36