获取当前工作目录路径方法:
os.path.abspath('.')
os.path.dirname(__file__)
os.getcwd()
获取地址后,返回上级目录:
os.pardir //返回上级目录
os.path.abspath(path) //获取绝对路径
os.path.join(path,path) //路径连接
os.path.abspath(os.path.join(os.path.abspath('.'),os.pardir,os.pardir)
获取当前工作目录路径方法:
os.path.abspath('.')
os.path.dirname(__file__)
os.getcwd()
获取地址后,返回上级目录:
os.pardir //返回上级目录
os.path.abspath(path) //获取绝对路径
os.path.join(path,path) //路径连接
os.path.abspath(os.path.join(os.path.abspath('.'),os.pardir,os.pardir)
转载于:https://www.cnblogs.com/Simply-face/p/4894364.html