# 循环递归遍历文件夹
def getFloderFiles(fileDir):
arr=[]
fs = os.listdir(fileDir)
for dir in fs:
tmp_path = os.path.join(fileDir, dir)
if os.path.isfile(tmp_path):
arr.append(tmp_path)
else:
# 是文件夹,则递归调用
arr.extend(getFloderFiles(tmp_path))
return arr
获得指定目录下文件列表
最新推荐文章于 2022-06-23 16:37:40 发布