1, the operator:
1.1, the operator types:
Operators | name | Explanation | example |
+ | plus | 5+4 | |
- | Less | ||
* | Multiply | ||
/ | except | ||
// | Take divisible | The integer part of the quotient | 3 // 2, the result is a |
% | Remainder | remainder | |
>> | Right | Binary right | |
<< | The left | Binary left | |
& | versus | Binary Bitwise AND | |
| | or | Binary Bitwise or | |
^ | XOR | Binary Bitwise XOR | |
~ | Overturn | Bitwise inversion of x is - (x + 1) | -6 ~ 5 Results |
< | Less than | ||
> | more than the | ||
<= | Less than or equal | ||
>= | greater or equal to | ||
== | equal | ||
!= | not equal to | ||
not | Boolean "NOT" | logic operation | |
and | Boolean "and" | logic operation | |
or | Boolean "or" | logic operation | |
** | power |
1.2, operator precedence:
Operators | description |
lambda | |
or | |
and | |
not | |
in, not in | |
is,is not | |
<,>,<=,>=,<>,!=,== | |
| | |
^ | |
& | |
<<,>> | |
+,- | |
*,/,% | |
+x,-x | |
~x | |
** | |
x.attribute | Property Reference |
x[index | Subscript |
x[index:index | Addressing section |
f(arguments...) | Function call |
(experession,...) | Binding or tuple display |
[expression,...] | List shows |
{key:datum...} | Dictionary display |
'expression,.' | String conversion |
First calculates high priority operation, and then will calculate a low priority operation, the same priority operation left to right, parentheses can contain change the priority
2, the expression:
By the operators, variables, characters and the like consisting of formula