Python · autopep8-Code-Spezifikationsprüfwerkzeug

Einführung in autopep8

autopep8 ist ein Open-Source- Befehlszeilentool, das Python-Code automatisch im PEP8-Stil formatiert. autopep8 verwendet das pycodestyle-Tool, um zu bestimmen, welche Teile des Codes formatiert werden müssen, wodurch die meisten Typografieprobleme behoben werden, die vom pycodestyle-Tool gemeldet werden. autopep8 selbst ist auch ein Tool, das in der Sprache Python geschrieben ist, sodass wir es direkt mit pip installieren können:

# 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

Supongo que te gusta

Origin blog.csdn.net/qq_37865996/article/details/124365334
Recomendado
Clasificación