1. os.path.abspath(__file__): 返回当前脚本的绝对路径 eg: C:\11\22\test.py
2. os.path.dirname(__file__): 返回当前脚本的父路径 eg: C:\11\22
返回的是运行时脚本文件的父路径,如:"Python ./test.py" 则返回父路径: "."
3. os.path.basename(__file__): 返回脚本的名称 eg: test.py
import os
aa = os.path.dirname(__file__)
print(aa)
bb = os.path.abspath(os.path.dirname(__file__))
print(bb)
cc = os.path.basename(__file__)
print(cc)