python获取父路径

import os
#获取父路径
def get_aft_path():
    return os.getcwd()
#获取父路径
def get_aft_parent_path():
    return os.path.abspath('')
可以通过os.path.abspath('..')返回多层路径

 

猜你喜欢

转载自blog.csdn.net/sterson/article/details/79803763
今日推荐