using os to enter a directory in python code example Example 1: python cd to directory import os os.chdir(path) Example 2: setwd python os.chdir("/home/varun/temp")