1、python獲取當前文件路徑以及父文件路徑
#當前文件的路徑
pwd = os.getcwd()
#當前文件的父路徑
father_path=os.path.abspath(os.path.dirname(pwd)+os.path.sep+".")
#當前文件的前兩級目錄
grader_father=os.path.abspath(os.path.dirname(pwd)+os.path.sep+"..")
1、python獲取當前文件路徑以及父文件路徑
#當前文件的路徑
pwd = os.getcwd()
#當前文件的父路徑
father_path=os.path.abspath(os.path.dirname(pwd)+os.path.sep+".")
#當前文件的前兩級目錄
grader_father=os.path.abspath(os.path.dirname(pwd)+os.path.sep+"..")
class MetaCls(type): def __new__(cls, *args, **kwargs): print("in MetaCls") # return super(Meta