Home > Article > Backend Development > How to cut a long line of code into multiple lines in python
How to cut a long line of code into multiple lines in python: 1. You can use backslashes to link multiple lines of code, the syntax is "22 \ 33"; 2. You can use parentheses to link, the syntax is "( 22 33)"; 3. Use three quotation marks to link, the syntax is "'''22 45'''", the three quotation mark method is only useful for strings.
#In the process of writing code, we often encounter situations where a line of code is 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 two tricks in Python to achieve this function:
1. Use backslashes to link multiple lines of code
Example output:
55
2. Surround it with parentheses
Example output:
55
Tip: There is a simple way to write longer strings divided into multiple lines: use three single quotes, but this method is only useful for strings.
The following code output:
32 + 45
The above is the detailed content of How to cut a long line of code into multiple lines in python. For more information, please follow other related articles on the PHP Chinese website!