首页 > 解决方案 > 如何使用python在文件夹中显示word文档的文件名?

问题描述

我想使用python显示指定路径中存在的word文档的文件名。

标签: pythonarraysdocumentdocx

解决方案


这可能对你有用:

for file in os.listdir(PATH):
    if file.endswith(".doc") or file.endswith(".docx"):
        print(file)

推荐阅读