In the process of writing code, often encountered a long line of code. 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 small tricks in Python to achieve this function:
a=22+\
33
printa
a=(22+33)
printa
Tip: There is another simple method for writing a long string into multiple lines: use three single quotes, but this method is only useful for strings. The following code output:
32+45
a='''32+45'''
printa
Summary supplement:
How to write code in python?
The Windows newline character is'\r\n',
The newline character for Unix/Linux is'\n',
The newline character for Mac is'\r',
In python, the newline character is processed uniformly and defined as'\n.
So far, this article on how to wrap lines in python code is introduced. For more related Python code how to wrap lines, please search for previous articles on ZaLou.Cn or continue to browse related articles below. Hope you will support ZaLou.Cn more in the future. !
Recommended Posts