如何创建循环手术室步行()查找所有“.txt”文件并创建具有三个字段的输出文件.csv
目录,文件名,语言?在
我可以使用print来获取文件名和目录,但我不知道如何将它们放入csv中。
另外,我可以使用langdetect(from langdetect import detect
,detect("001.txt"
)获得语言名称,但是我被困在下面的循环问题上。在
示例
Directory Filename Language
/c/xx 001 en
/c/xx/y 001 fr
代码
^{pr2}$
过滤器文件
Tags:
如果您需要检查子目录中的文件以及当前目录中的文件,这样做是一个很好的方法。在
它使用
os.walk
遍历目录结构,使用fnmatch.fnmatch
进行(简单)文件名匹配。在相关问题 更多 >
编程相关推荐