- import os
- #获取当前脚本文件路径
- print os.path.dirname(os.path.abspath(__file__))
- #获取当前路径的上级目录
- print os.path.abspath(os.path.dirname(os.path.dirname(__file__)))
- print os.path.abspath(os.path.join(os.path.dirname(__file__),".."))
python 路径处理
最新推荐文章于 2023-01-28 16:06:25 发布