python获取当前脚本路径和父目录
def GetParentPath(strPath):if not strPath:
return None;
lsPath = os.path.split(strPath);
print(lsPath);
print("lsPath = %s" %lsPath);
if lsPath:
return lsPath;
lsPath = os.path.split(lsPath);
return lsPath;
strPath = GetCurrPath();
print("curr path: %s" %strPath);
#print(GetParentPath(strPath));
strPath += "/";
print(GetParentPath(strPath));
print(GetParentPath("/"));
页:
[1]