代码: (使用os.listdir) 复制代码 代码如下: import os def ListFilesToTxt(dir,file,wildcard,recursion): exts = wildcard.split(” “) files = os.listdir(dir) for name in files: fullname=os.path.join(dir,name) if(os.path.isdir(fullname) & recursion): ListFilesToTxt(fullname,fil