PEP 8: E701 multiple statements on one line (colon)
时间: 2024-03-21 16:42:25 浏览: 174
PEP 8 is a style guide for Python code that provides guidelines on how to write clean and readable code. E701 is a specific code style violation that occurs when multiple statements are written on the same line, separated by a colon.
To fix this issue, you should separate each statement onto its own line. This will make your code more readable and easier to understand. Here is an example of code that violates PEP 8 E701:
```
if x == 1: print("Hello"); y = 2
```
And here is the corrected code that follows PEP 8:
```
if x == 1:
print("Hello")
y = 2
```
By separating the statements onto their own lines, it is easier to see what each statement is doing and how they relate to each other.
阅读全文