📜  python 位运算符方法 - Python 代码示例

📅  最后修改于: 2022-03-11 14:46:14.086000             🧑  作者: Mango

代码示例1
#PYTHON BITWISE OPERATORS
OPERATOR    DESCRIPTION            SYNTAX  FUNCTION        IN-PLACE METHOD
&            Bitwise AND            a & b   and_(a, b)      __and__(self, other)
|            Bitwise OR            a | b   or_(a, b)       __or__(self, other)
^            Bitwise XOR            a ^ b   xor(a, b)       __xor__(self, other)
~           Bitwise NOT         ~ a     invert(a)       __invert__(self)
<<          Bitwise L shift     a << b  lshift(a, b)    __lshift__(self, other)
>>          Bitwise R shift     a >> b  rshift(a, b)    __irshift__(self, other)