get script path python code example Example 1: python get script path os.getcwd() Example 2: python how to get directory of script import os print(os.path.abspath(''))