python os execution directory code example Example 1: get diroctary in python import os cwd = os.getcwd() print(cwd) Example 2: get working directory python import os os.getcwd()