os package in python change directory code example Example 1: setwd python os.chdir("/home/varun/temp") Example 2: how to change os path in python os.chdir(path)