The physical line is what you see when you write the program. The logical line is a single statement that Python sees. Python assumes that each physical row corresponds to a
A logical line.
An example of a logical line is a statement like print ' Hello world '--if it is a line (as you see in the editor), it is also a physical line.
By default, Python wants to use only one statement per line, which makes the code easier to read.
If you want to use more than one logical line in a physical row, you need to use semicolons (;) to specifically indicate this usage. Semicolon
# For example:i = 5print i# is the same as the following:i = 5; Print i; # It can also be written as: Print i; # can even be written as: Print I
It is strongly recommended that you persist in each physical line by writing only one line of logic. Just when the logical line is too long, write in more than one physical line
A logical line. This is to avoid using semicolons as much as possible, making the code easier to read. In fact, I have never been in Python
You have used or seen excessive numbers in the program.
Here is an example of writing a logical line in multiple physical rows. It is known as a clear row connection.
A polygon is an example of writing a logical line in multiple physical rows. It is known as a clear row connection.
' This is a string. This continues the string. ' Print is a string. This continues the string. Similarly,print i works the same as the following:print i
Sometimes, there is a hint of a hypothesis that can make you do not need to use backslashes. This situation occurs in logical lines using parentheses, Fang Kuo
or curly braces. This is referred to as the implied line connection. You'll see this usage in the sections that explain how to use the list later.
Logical lines and physical lines