首页 > 解决方案 > PyCharm 专业版中的自动格式化导入

问题描述

我最近偶然发现IntelliJ PyCharm PE开始自动优化我的导入的问题,但我从未启用/安装过此类功能,但是我确实安装了isort ,但我不记得它有自动优化选项。有谁知道如何解决这个问题?

示例:我正在查看代码:

from here import this
from here2 import this2
from here1 import this1

当我通过 ( Alt+0 ) PyCharm 的提交接口进行提交阶段时,它会将这些导入自动格式化为:

from here import this
from here1 import this1
from here2 import this2

标签: pythonpycharmide

解决方案


因此,事实证明 Pycharm 在通过位于设置/工具部分下的文件观察器功能保存/提交更改时自动格式化我的导入,禁用它有助于自动格式化。


推荐阅读