Python splits a long line of code into multiple lines

Overview: In the process of writing code, one line of code is often very long. In order to make the code look neat and clean, you need to divide one line of code into multiple lines to write. There are three small tricks in Python to achieve this function:

1. Use backslash\ to link multiple lines of code

2. Enclose in parentheses

 

3. There is also a simple method for writing long strings into multiple lines: use three single quotes, but this method is only useful for strings.

 

 

classification: 

Guess you like

Origin blog.csdn.net/sanmi8276/article/details/108733075
Recommended