python - 如何使用python在文件夹中显示word文档的文件名?
问题描述
我想使用python显示指定路径中存在的word文档的文件名。
解决方案
这可能对你有用:
for file in os.listdir(PATH):
if file.endswith(".doc") or file.endswith(".docx"):
print(file)
推荐阅读
- c++ - C++ 运行时错误:添加无符号偏移量?
- javascript - 如何重定向点击通知?
- sql - Oracle sql先排序较大的日期,基于2个日期列
- powershell - 从 AD 组获取特定的 AD 用户
- oracle - oracle 中的数据清除
- angular - 在 nginx 中部署 Angular 应用程序,提供静态资源忽略 url 子路径
- c++ - 使用 readability-identifier-naming 时 clang-tidy 将命名空间视为全局变量
- ios - 如何在 Swift 中动态获取数组中特定数量的元素?
- kubernetes - Terraform 脚本在创建新命名空间之前破坏先前创建的 kubernetes 命名空间
- bash - Saltstack cloud.map 与 Bash 变量