Stats

629 Contributors: 18
2017-01-29
Licensed under: CC-BY-SA

Not affiliated with Stack Overflow
Rip Tutorial: info@zzzprojects.com

Download eBook

Bitwise Operators

Download python eBook

Introduction

Bitwise operations alter binary strings at the bit level. These operations are incredibly basic and are directly supported by the processor. These few operations are necessary in working with device drivers, low-level graphics, cryptography, and network communications. This section provides useful knowledge and examples of Python's bitwise operators.

Syntax

  • x << y # Bitwise Left Shift

  • x >> y # Bitwise Right Shift

  • x & y # Bitwise AND

  • x | y # Bitwise OR

  • ~ x # Bitwise NOT

  • x ^ y # Bitwise XOR

Related Examples