os.path

os.path.dirname(path)

去掉文件名,返回路径

os.path.abspath(__file__)

返回当前文件的绝对路径

原文地址:https://www.cnblogs.com/ruguokeyi/p/11890493.html