python-3.x - 如何使用 Python 3 检索 .msg 和 .MSG 文件?
问题描述
以下 Python 代码仅检索“.msg”文件
files = [f for f in os.listdir(path) if '.msg' in f]
如何添加它以便它也能检索“.MSG”文件?
解决方案
files = [f for f in os.listdir(path) if '.msg' in f or '.MSG' in f]
您可以在列表理解中使用or
和链接条件and
推荐阅读
- javascript - 从express api + react中的给定路径下载zip文件
- c - 每次子进程完成某个任务时如何向父进程发送 SIGUSR1 信号
- typescript - 通过 Typescript 构建 Vite 和 Global Vue 3 组件
- swift - 如何创建 switch 语句 - 使用 UISegmentedControl - 在视图控制器之间切换?
- html - CSS / HTML - 更改字母颜色
- svg - Viewbox改变元素的宽度
- javascript - 检测用户是否使用 javascript 或 jquery 输入电子邮件或号码
- c# - 更新 Firebase 实时数据库中的多个节点
- gatling - 在 Gatling 负载测试中无法获取服务器设置的 cookie 值
- c# - .Net Framework 项目上的 Visual Studio 代码分析