1.将路径转化为以"\“或”/"进行分割的list
#将路径转化为以"\\"或"/"进行分割后的List
def getPathList(path):
retList=[]
i=0
start=0
for i in range(0,len(path)):
if(path[i]=="\\" or path[i]=="/"):
retList.append(path[start:i])
start=i+1
retList.append(path[start:])
return retList
- 路径的遍历在windows的共享文件夹中比较慢优化用
glob.glob进行优化
3.对输入路径进行检测检测到不存在时创建,否则 pass
def checkDir(self,nowPath):
#当前路径存在
if(os.path.exists(nowPath)):
pass
else:
os.makedirs(nowPath)