Search code examples
pythonarraysbit

How to create an array of bits in Python?


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


Solution

  • from bitarray import bitarray
    
    a = bitarray(2**20)
    

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