import os print(os.getcwd())
输出结果:C:\Users\AI\PycharmProjects\untitled
C:\Users\AI\PycharmProjects\untitled