Learn Before
Concept
Bitwise Operators in Python
In Python, bitwise operators allow the direct manipulation of individual bits (1s and 0s) within a bit string. The primary bitwise operators in Python include:
- Bitwise AND (
&): Compares two bit strings and returns a new bit string with1s only where both corresponding bits are1. - Bitwise OR (
|): Compares two bit strings and returns a new bit string with1s where at least one corresponding bit is1. - Bitwise Left Shift (
<<): Shifts the bits of the first operand to the left by the number of positions specified by the second operand. - Bitwise Right Shift (
>>): Shifts the bits of the first operand to the right by the number of positions specified by the second operand.
0
1
Updated 2026-07-07
Contributors are:
Who are from:
Tags
Python Programming Language
Data Science