Here is a collection of small knowledge points, for the convenience of later search.
Line and indent:
Physical line: The number of lines of code actually seen.
Logical line: function in meaning (that is, the number of rows performed by the interpreter)
If a physical row contains more than one logical row, each logical line needs to be separated by a semicolon ";" , and the last logical line can omit the semicolon
A logical line is divided into multiple physical lines using the escape character "\" to make a connection between each physical row
Indent: white space at the beginning of a logical line, usually without leaving a blank at the beginning
Indent for if and while statements: one tab character under conditions
Operator:
: Division, rounding down
%: Take the remainder
&: Bitwise AND operation in binary
|: Bitwise OR
^: Bitwise XOR (different 1, same as 0)
~: Bitwise rollover ~x=-(X+1)
<<: Binary left shift, left n units equal to multiplied by 2^n
>>: Binary right SHIFT, right shift n units equal to divided by 2^n
Operator Precedence:
-
- function invocation, addressing, subscript
- Power Operation * *
- Rollover operations
- PLUS sign
- * / %
- + -
- << >>
- & ^ |
- Comparison operators:> < >= <=
- Logical NOT and OR
- Lambda expression
The difference between the expression and print execution: the expression enters a single-line command on the command line, such as: >>>a= "Hello" >>>a will have ' hello ' and if print (a), it is hello, without quotation marks.
Small knowledge points in Python