Python 父目录获取

# coding=utf-8
import os

currentPath = os.getcwd() # 当前目录
parent_path = os.path.dirname(currentPath) #将当前目录传入得到当前目录的父目录
print(parent_path)
原文地址:https://www.cnblogs.com/shortboy/p/4785125.html