Python · autopep8 code specification check tool

Introduction to autopep8

autopep8 is an open source command line tool that automatically formats Python code into PEP8 style. autopep8 uses the pycodestyle tool to determine which parts of the code need to be formatted, which fixes most of the typography issues reported by the pycodestyle tool. autopep8 itself is also a tool written in the Python language, so we can install it directly using pip:

# pip install autopep8


# autopep8 --in-place /path/to/optparse.py 


'''To modify a file in place (with aggressive level 2):'''
autopep8 --in-place --aggressive --aggressive <filename>

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] [--hang-closing] [--exit-code]
                [files [files ...]]

Automatica

Guess you like

Origin blog.csdn.net/qq_37865996/article/details/124365334