How to create an array of bits in Python?

zheric picture zheric · Jul 26, 2012 · Viewed 60.8k times · Source

How can I declare a bit array of a very large size, say 6 million bits?

Answer

SJP picture SJP · Jul 26, 2012
from bitarray import bitarray

a = bitarray(2**20)

You can check out more info about this module at http://pypi.python.org/pypi/bitarray/