Pycharm Configuring the Autopep8 tutorial to make Python code more compliant with the PEP8 specification

Source: Internet
Author: User

First, what is PEP8?
    • PEP 8 Official documentation-Style guide for Python Code

    • PEP8 Chinese Translation (EXT)

Second, pycharm in the configuration Pep8

PycharmThere is a pep8 style test in itself, and when you do not conform to the specification in the code, there will be a wavy line hint. How do you change the code to conform to the specification and remove these unsightly wave floss? Here are the steps:

2.1 Installing AUTOPEP8

CMD window input:pip install autopep8

2.2 Installing the AUTOPEP8 configuration in Pycharm
    • Tools→extends tools→ Click the plus sign

    • 650) this.width=650; "Src=" Https://segmentfault.com/img/bVyzil " Style= "border:1px solid rgb (221,221,221); vertical-align:middle;padding:3px;" alt= "Bvyzil"/>

    • configuration item

650) this.width=650; "src=" Https://segmentfault.com/img/bVyzik "style=" border:1px solid rgb (221,221,221); vertical-align:middle;padding:3px; "alt=" Bvyzik "/>

  • NAME:AUTOPEP8 (can be taken casually)

  • Tools settings:

    • PROGRAMS:AUTOPEP8 (if you've already installed it)

    • Parameters:--in-place--aggressive--aggressive $FilePath $

    • Working directory: $ProjectFileDir $

  • Click Output files→ Add, in the dialog box: Regular expression to match output input: Code style= "font-family: ' Source code Pro ', Consolas, Menlo, Monaco, ' Courier New ', Monospace;font-size:.93em;color:rgb ( 199,37,78); Background-color:rgb (249,242,244);p adding:2px 4px; " > $FILE _path$\: $LINE $\: $COLUMN $\:.*

AUTOPEP8 in Pycharm: Create a new Python file in Pycharm Edit, edit some code that does not conform to the PEP8 style, and place the mouse in the editor of the file → right-click →external tools→ tap Autopep8. This way your code will fit into the PEP8 style. As shown in
650) this.width=650; "src=" HTTPS://SEGMENTFAULT.COM/IMG/BVYZJQ "style=" border:1px solid rgb (221,221,221); Vertical-align:middle;padding:3px;color:rgb (51,51,51); font-family: ' Helvetica Neue ', Helvetica, Arial, ' Pingfang SC ' , ' Hiragino Sans GB ', ' Wenquanyi Micro Hei ', ' Microsoft Yahei ', sans-serif;font-size:14px;white-space:normal; Background-color:rgb (255,255,255); "alt=" BVYZJQ "/>

This article is from the "tcollaboration" blog, make sure to keep this source http://tcollaboration.blog.51cto.com/6328404/1875663

Pycharm Configuring the Autopep8 tutorial to make Python code more compliant with the PEP8 specification

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.