python chdir code example Example 1: python cd to directory import os os.chdir(path) Example 2: os.chdir python os.chdir("directory name")