Bit Manipulations with Python are techniques that allow you to operate on the bits of variables. In other words, bit manipulations with Python allows you to operate on individual bit or on group of bits of a variable.

In the following articles, we see the following bit manipulations:

Bit manipulation on a single bit

Bit manipulation on a group of bits

    • How to set selected group of bits
    • How to clear selected group of bits
    • How to complement selected group of bits
    • How to check if all the bits in selected group of bits are set
    • How to check if all the bits in selected group of bits are cleared
    • How to check if any bit in selected group of bits are set
    • How to check if any bit in selected group of bits are cleared
Series NavigationPython Bitwise Operators >>