Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

python bitwise operators

<int> = <int> & <int>                    # And (0b1100 & 0b1010 == 0b1000).
<int> = <int> | <int>                    # Or  (0b1100 | 0b1010 == 0b1110).
<int> = <int> ^ <int>                    # Xor (0b1100 ^ 0b1010 == 0b0110).
<int> = <int> << n_bits                  # Left shift (>> for right).
<int> = ~<int>                           # Not (also: -<int> - 1).
Source by wiki.python.org #
 
PREVIOUS NEXT
Tagged: #python #bitwise #operators
ADD COMMENT
Topic
Name
1+3 =