pep 8: e122 continuation line missing indentation or outdented
时间: 2023-04-25 13:05:48 浏览: 1277
PEP 8规定的E122错误是指缺少缩进或缩进不正确的连续行。这意味着在多行代码中,每行代码的缩进应该与前一行代码的缩进保持一致,否则就会出现E122错误。要解决这个错误,需要检查代码中的缩进,并确保每行代码的缩进正确。
相关问题
PEP 8: E128 continuation line under-indented for visual indent
PEP 8 is a style guide for Python code and its E128 error message means that the continuation line is under-indented compared to the visual indentation. In other words, the continuation line should be indented by at least 4 spaces (or one tab) from the previous line's indentation level.
Here's an example code snippet that violates this rule:
```
def some_function(arg1, arg2,
arg3, arg4):
# code here
```
To fix this error, we can increase the indentation level of the continuation line to match the previous line's visual indentation:
```
def some_function(arg1, arg2,
arg3, arg4):
# code here
```
It's important to follow PEP 8 guidelines to write clean and consistent code that is easy to read and maintain.
阅读全文