Continuation line missing indentation or ignored

Website content quality is poor, distribution efficiency is too low how to do?Huawei engineers offer 5 unique skills>>>

Pycharm configures autopep8 to format Python code automatically

1. About PEP 8

PEP 8, style guide for Python code, is the official coding convention of python, mainly to ensure the consistent style of Python coding and improve the readability of code

Official website address: https://www.python.org/dev/peps/pep-0008/

2. About autopep8

Autopep8 is a tool that automatically formats Python code to conform to the style of PEP 8. It uses the pycodestyle tool to determine which parts of the code need to be formatted. Autopep8 can fix most of the format problems detected by pycodestyle

GitHub address: https://github.com/hhatto/autopep8

3. Download and install autopep8

pip installautopep8

4. Use autopep8

The command line is used as follows

$autopep8 — in place — aggressive — aggressive file name

5. How to configure autopep8 with pcharm

1) Select the menu “file” – > ” Settings」–>「 Tools」–>「 External Tools」–> Click the plus sign to add a tool

2) Fill in the following configuration items and click OK to save

Name: autopep8 (optional)

Tools settings:

Programs:autopep8

Parameters:–in-place –aggressive –ignore=E123,E133,E50 $FilePath$

Working directory:$ProjectFileDir$

3) Select the menu “tool” – > ” Extern Tools」–>「 Autopep8 “can use autopep8 to format your Python code automatically

Similar Posts: