检索文件夹内所有文件 发表评论 / Python / 作者: Fivyex / 6月 21, 2023 需求 找到文件夹内所有的txt文档的路径 解决 from pathlib import Path result = list(Path(".").rglob("*.[tT][xX][tT]")) 参考 https://stackoverflow.com/questions/18394147/how-to-do-a-recursive-sub-folder-search-and-return-files-in-a-list