python study notes four (Bitwise operators, relational operators, logical operators, members of the operators, the identity operator)

1. The bitwise operators : bitwise operators is seen as the digital binary number is calculated
&: Bitwise AND operator; corresponding bits are 1, the result of 1 bit, otherwise 0
Here Insert Picture Description
|: Press bitwise oR operator; two binary bit is a 1, the result of bit 1
Here Insert Picture Description
^ bitwise exclusive oR operator; two different binary result is 1, otherwise 0
Here Insert Picture Description
~ bitwise operators; per binary data bits are inverted, 0,0 variant 1 variant 1
Here Insert Picture Description
<< operator moves left; all left movement of each bit a number of bits, number of bits determined by the mobile number to the right of the <<, discarding high, low zero padding
Here Insert Picture Description

Right mobile operator; all right movement of each bit a number of bits, number of bits determined by the mobile number to the right of the <<, discarding low, high zero padding
Here Insert Picture Description
2. The relational operators and relational operation expression
Relational operators: == =! > <> = <=
relational operation expression
format : Relational operators expression 1 expression 2
** function: ** value calculation expression 1 and expression 2
** values: ** If the relation holds, the entire relationship operation expression is true, false otherwise
3. logical operators
logical aND and
logical aND operation expression
format: expression 1 and expression 2
values: 1 if the expression is true, the value of the expression 2 is also is true, then the overall operation of the logic expression is true;
if the true value of expression 1, expression 2 is false, then the overall operation of the logic expression is false;
value of 1 if the expression is false, the true value of the expression 2, the overall logic and arithmetic expression is false;
if the expression 1 is false, a false value of the expression 2, the overall logic and arithmetic expression is false
[a] false is false
logic or or
logical or arithmetic expression:
Format: Expression 1 or Expression 2
values: 1 if the expression is true, the value of the expression 2 is also true, then the overall operation or a logical expression is true;
if the expression evaluates to a true, 2 is also the value of the expression is false, then the value of the overall expression true logical oR operation;
If the expression evaluates to false one, the value of the expression 2 is also true, then the value of the overall operation or a logical expression true ;
If expression 1 is false, the value of the expression 2 is also false, then the overall operation or a logical expression is false;
[a] will be true is true
logical NOT not
logical NOT expression
format: not expression
values: If the expression is true, the overall logical NOT expression is false;
value if the expression is false, the entire logical NOT expression true
[] and wrong
4. members operators
in: if the found value in the specified sequence returns True, otherwise return False
not in: If no value in the specified sequence returns True, otherwise return False
5. the identity of the operator
is: Analyzing two identifiers are not quoted the same object
is not: to determine if two identifiers are not reference the same object

Guess you like

Origin blog.csdn.net/weixin_38324954/article/details/91447182