About PEP 8
PEP 8,style Guide for Python code, is the official Python coding convention, mainly to ensure that the Python coding style consistent, improve the readability of the code.
Website address: https://www.python.org/dev/peps/pep-0008/
About AUTOPEP8
AUTOPEP8 is a tool that automatically formats Python code to conform to THE PEP 8 style. It uses the Pycodestyle tool to determine which parts of the code need to be formatted. AUTOPEP8 can fix most of the formatting problems of pycodestyle detection.
GitHub Address: HTTPS://GITHUB.COM/HHATTO/AUTOPEP8
Installation:
Pip Install Autopep8
Use the command:
AUTOPEP8--in-place--aggressive--aggressive <filename>
Parameter description:
>USAGE:AUTOPEP8 [-h] [--version] [-v] [-d] [-i] [--Global-config filename]> [--ignore-local-config] [-r] [-j n] [-P n] [-A]> [--experimental] [--exclude globs] [--list-fixes]> [--ignore errors] [--select errors] [--max-line-length n]> [--line-range Line line]>[files [files ...]]> > Automatically formats Python code to conform to the PEP 8style guide.> >positional arguments:> Files Files to formator '-' forStandardinch> >Optional arguments:>-H,--help show this help message andExit>--version Show Program'S version number and exit>-V,--verbosePrintverbose messages; Multiple-v resultinch More>Verbose Messages>-D,--diffPrintThe diff forThe fixed source>-I.,--inch-place make changes to filesinch Place>--Global-config filename> Path to aGlobalPep8 config file;ifThis file does> notexist then this isignored (default:> ~/.config/PEP8)>--ignore-local-Config> Don'T look for and apply local config files;> passed, defaults is updated with any config filesinch> The Project's root directory>-R,--recursive run recursively over directories; must is used with>--inch-placeor--diff>-j N,--jobs n number of parallel jobs; Match CPU CountifValue is> Less than 1>-P N,--pep8-Passes N>Maximum number of additional PEP8 passes (default:>infinite)>-A,--aggressive enable non-whitespace changes; Multiple-a resultinch>More Aggressive Changes>--Experimental enable experimental fixes>--exclude globs exclude file/directory names that match these comma->separated globs>--list-fixes list Codes forFixes Used by--ignore and--Select>--ignore errors Do notFix these errors/warnings (DEFAULT:E24)>--select errors fix only these errors/warnings (e.g. e4,w)>--max-line-length n Set maximum allowed line length (default:79)>--line-range Line,--Range Line line>Only fix errors found within this inclusive range of> line numbers (e.g. 1 99); Line numbers is indexed at
Python Basic Autopep8__python Code specification