Python
supports following bitwise operators, to perform bit wise operations on
integers.
Operator
|
Description
|
>>
|
bitwise right
shift
|
<<
|
bitwise left
shift
|
&
|
bitwise
and
|
^
|
Bitwise
Ex-OR
|
|
|
Bitwise or
|
~
|
Bitwise
not
|
Following post, explains bitwise operators clearly.
>>> a=2 >>> a>>1 1 >>> >>> a<<1 4 >>> >>> a&3 2 >>> a|3 3 >>> >>> ~a -3
No comments:
Post a Comment