def get_FileList(level,path,f_name):
fileList = []
dirList = []
files = os.listdir(path)
dirList.append(str(level))
for f in files:
if(os.path.isdir(path + '/' + f)):
if(f[0] == '.'):
pass
else:
dirList.append(f)
for f in files:
if(os.path.isfile(path + '/' + f)):
if(f_name in f):
fileList.append(path + '/' +f)
i_dl = 0
for dl in dirList:
if(i_dl == 0):
i_dl = i_dl + 1
else:
get_FileList((int(dirList[0]) + 1), path + '/' + dl,f_name)
return fileList
python读取文件夹中的文件
最新推荐文章于 2024-07-25 11:29:07 发布