Search⌘ K

Bit Operations

Explore Python's bit operations to manipulate integers at the binary level. Learn how each operator works, including bitwise complement, and, or, exclusive or, left shift, and right shift. Understand how these operators modify bits to perform efficient low-level data processing in your programs.

Bit operators overview

The following bit operators may be applied to integers.

Bit Operator Description
~ Bitwise complement
& Bitwise and
| Bitwise or
^ Bitwise exclusive or
<< Left shift
>> Right shift
...