# 用绝对路径执行文件,例如python /home/zwixn/Car/Flask/project1/test.py
# 返回值是上一级目录,/home/zwixn/Car/Flask/project1
os.path.dirname(__file__) # 用相对路径执行文件,返回值是空字符串,例如 python test.py
# # 返回连带着文件名的绝对路径,/home/zwixn/Car/Flask/project1/test.py
os.path.abspath(__file__)
os.path
于 2022-01-12 09:21:55 首次发布