pep8规范-常见错误 python-vscode

来源:互联网 发布:移动办公软件技术指标 编辑:程序博客网 时间:2024/05/29 18:10

错误记录:E302 expected 2 blank lines, found 1

处理:上面只有一行空白,但是需要两个空白行


错误记录:E225 missing whitespace around operator

翻译:符号(=、,、等)周围缺少空格

举例:

        错误 classmates=['aaa', 'bbb', 'ccc']

        正确 classmates = ['aaa', 'bbb', 'ccc']


下面是顺带搜到的常见错误,已备后用:


错误记录:E501 line too long

处理:这个不可避免的,不要管就行。


错误记录:W292 no newline at end of file

处理:打个回车有新的一空行即可(新行不要有空格)。


错误记录:E231 missing whitespace after ‘,’

错误记录:E231 missing whitespace after ‘:’

翻译:“,”“:”后要有空格

举例:
        错误 print(“%s %s %s %s %s %s” % (A,B,D,E,K,L))

    正确 print(“%s %s %s %s %s %s” % (A, B, D, E, K, L))


参考文章:http://www.voidcn.com/article/p-vyzyxlzo-gq.html

原创粉丝点击