os chdir python code example Example 1: os.chdir python os.chdir("directory name") Example 2: os.chdir go back import os os.chdir('..')