Python中PEP8常见错误表

PEP8常见错误表

错误代码PEP 8规范解释
E117 over-indented缩进应该使用4个空格代码缩进超过了4个空格
E111 indentation is not a multiple of four缩进应该使用4个空格代码缩进不是4的倍数
E231 missing whitespace after ‘,’逗号后应该有空格逗号后没有空格
E302 expected 2 blank lines, found 1期望有2个空行,但只找到了1个函数或类之间应该有2个空行,但只有1个空行
E501 line too long (82 > 79 characters)一行代码超过了79个字符一行代码的长度超过了规定的79个字符
E261 at least two spaces before inline comment行内注释前应该有至少2个空格行内注释前没有至少2个空格
E401 multiple imports on one line一行上有多个导入应该将每个导入独占一行
E265 block comment should start with ‘#’块注释应该以’#'开头块注释没有以’#'开头
E303 too many blank lines (2)空行过多(2个)空行的数量超过了规定的2个
E711 comparison to None should be ‘if cond is None:’与None比较应该使用’if cond is None:’使用了与None比较的错误写法
E112 expected an indented block预期一个缩进的代码块缺少了预期的缩进代码块
E225 missing whitespace around operator运算符周围应该有空格运算符周围缺少了空格
E231 missing whitespace after ‘:’冒号后应该有空格冒号后没有空格
E261 at least two spaces before inline comment行内注释前应该有至少2个空格行内注释前没有至少2个空格
E302 expected 2 blank lines, found 0期望有2个空行,但找到了0个函数或类之间应该有2个空行,但没有
E303 too many blank lines (3)空行过多(3个)空行的数量超过了规定的3个
E225 missing whitespace around operator运算符周围应该有空格运算符周围缺少了空格
E251 unexpected spaces around keyword / parameter equals关键字/参数等号周围不应该有空格关键字/参数等号周围有意外的空格
E262 inline comment should start with ‘#’行内注释应该以’#'开头行内注释没有以’#'开头
E402 module level import not at top of file模块级别的导入不在文件顶部导入语句应该在文件顶部
E211 whitespace before ‘(’'('之前不应该有空格'('之前有空格
E126 continuation line over-indented for hanging indent悬挂缩进的连续行缩进过多悬挂缩进的连续行缩进过多
E301 expected 1 blank line, found 0期望有1个空行,但找到了0个函数或类与上一个代码块之间应该有1个空行,但没有
E121 continuation line indentation is not a multiple of four悬挂缩进的连续行缩进不是4的倍数悬挂缩进的连续行缩进不是4的倍数
E126 continuation line over-indented for hanging indent悬挂缩进的连续行缩进过多悬挂缩进的连续行缩进过多
E261 at least two spaces before inline comment行内注释前应该有至少2个空格行内注释前没有至少2个空格
E201 whitespace after ‘(’'('之后应该有空格'('之后没有空格
E251 unexpected spaces around keyword / parameter equals关键字/参数等号周围不应该有空格关键字/参数等号周围有意外的空格
E501 line too long (83 > 79 characters)一行代码超过了79个字符一行代码的长度超过了规定的79个字符
E224 missing whitespace around operator运算符周围应该有空格运算符周围缺少了空格
E303 too many blank lines (6)空行过多(6个)空行的数量超过了规定的6个
E127 continuation line over-indented for visual indent可视缩进的连续行缩进过多可视缩进的连续行缩进过多
E302 expected 2 blank lines, found 3期望有2个空行,但找到了3个函数或类之间应该有2个空行,但有3个空行
E261 at least two spaces before inline comment行内注释前应该有至少2个空格行内注释前没有至少2个空格
E303 too many blank lines (7)空行过多(7个)空行的数量超过了规定的7个
E301 expected 1 blank line, found 2期望有1个空行,但找到了2个函数或类与上一个代码块之间应该有1个空行,但有2个空行
E225 missing whitespace around operator运算符周围应该有空格运算符周围缺少了空格
E402 module level import not at top of file模块级别的导入不在文件顶部导入语句应该在文件顶部
E111 indentation is not a multiple of four缩进应该使用4个空格代码缩进不是4的倍数
E225 missing whitespace around operator运算符周围应该有空格运算符周围缺少了空格
E261 at least two spaces before inline comment行内注释前应该有至少2个空格行内注释前没有至少2个空格
E127 continuation line over-indented for visual indent可视缩进的连续行缩进过多可视缩进的连续行缩进过多
E302 expected 2 blank lines, found 4期望有2个空行,但找到了4个函数或类之间应该有2个空行,但有4个空行
E261 at least two spaces before inline comment行内注释前应该有至少2个空格行内注释前没有至少2个空格
E126 continuation line over-indented for hanging indent悬挂缩进的连续行缩进过多悬挂缩进的连续行缩进过多
E225 missing whitespace around operator运算符周围应该有空格运算符周围缺少了空格
E302 expected 2 blank lines, found 5期望有2个空行,但找到了5个函数或类之间应该有2个空行,但有5个空行
E501 line too long (85 > 79 characters)一行代码超过了79个字符一行代码的长度超过了规定的79个字符
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值