def ListFiles(dir) :
print "list file in dir ", os.path.abspath(dir)
subdir = []
for item in os.listdir(os.path.abspath(dir)) :
if os.path.isfile(os.path.join(dir, item)) :
print item
else :
subdir.append(os.path.join(dir, item))
for sdir in subdir :
ListFiles(sdir)
本文介绍了一个Python函数,用于递归地列出指定目录及其子目录中的所有文件。
4128

被折叠的 条评论
为什么被折叠?



