redundant-open-modes (UP015) 源自 pyupgrade linter。 修复总是可用的。 作用 检查多余的 open 模式参数。 为什么这不好? 多余的 open 模式参数是不必要的,应该删除以避免混淆。 示例 with open("foo.txt", "r") as f: ... 建议改为 with open("foo.txt") as f: ... 参考 Python 文档:open