How to disable auto import when I return in my code
As shown in the diagram above,after I choose re.findall
at row: 20. PyCharm will auto append "import \ re"
for me,I want to close that but I don`t know the method.
For Python auto-import can't be fully disabled in the current version of PyCharm, see Disable auto import. Only the import style and tooltip can be adjusted, see Automatically add import statements.
The example in the question with a line break is not typical, one possible reason for this is the file extension being .config
and not .py
.
import \
re
What is happening is the line is being wrapped, a combination of several settings can cause this. Go to File
>
Settings
>
Editor
>
Code Style
>
Python
>
Wrapping and Braces
. If the first option Hard wrap at:
is set to a high value (e.g 120) then confirm the option in "From" Import Statements
is Do not Warp
. See the screenshot:
One side-effect is that imports might not wrap automatically on longer lines. However, you can always refactor the code afterwards.