One, Python operator-related
The Python language supports the following types of operators:
- Arithmetic operators
- Compare (relational) operators
- Assignment operators
- logical operators
- Bitwise operators
- Member operators
- Identity operator
- Operator Precedence
1. Python Arithmetic operators
2. Python comparison operators
3. Assignment operators
4. Python logical operators
5. Python Bitwise operators
6. Python member operators
7. Python identity operator
Second, the precedence of the Python operator
The following table lists all the operators from highest to lowest priority:
| operator |
Description |
| ** |
Index (highest priority) |
| ~ + - |
Bitwise flip, unary Plus and minus (the last two methods are called [email protected] and [email protected]) |
| * / % // |
Multiply, divide, modulo, and divide |
| + - |
Addition subtraction |
| >> << |
Shift right, left shift operator |
| & |
Bit ' and ' |
| ^ | |
Bitwise operators |
| <= < > >= |
Comparison operators |
| <> = = = |
equals operator |
| = %= /= //= -= += *= **= |
Assignment operators |
| Is isn't |
Identity operator |
| In No in |
Member operators |
| Not OR and |
logical operators |
(c) Python operators