#用栈的方式模拟递归遍历目录import osdef getAllDirDE(path): stack=[]#定义空栈 stack.sppend(path)#给栈赋值当前文件路径 #处理栈,当栈为空时结束循环 while len(stack)==0: #从栈里取出数据(绝对路径) dirPath=stack.pop() #目录下所有文件
专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]
Copyright (C)ICode9.com, All Rights Reserved.
ICode9版权所有