os.chdir() code example Example 1: os.chdir python os.chdir("directory name") Example 2: how to change os path in python os.chdir(path)