Python how to change directory using a variable code example Example: change directory in python os import os path = "C:\Users\Your\Directory" os.chdir(path)