unnecessary-builtin-import (UP029) 源自 pyupgrade linter。 修复总是可用的。 作用 检查不必要的内置模块导入。 为什么这不好? 内置模块始终可用。 导入它们是不必要的,应该删除以避免混淆。 示例 from builtins import str str(1) 建议改为 str(1) 参考 Python 文档: Python 标准库