https://github.com/bmoscon/bit_array
Pure Python Bit Array
https://github.com/bmoscon/bit_array
Last synced: 7 months ago
JSON representation
Pure Python Bit Array
- Host: GitHub
- URL: https://github.com/bmoscon/bit_array
- Owner: bmoscon
- License: other
- Created: 2016-09-16T22:31:56.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2016-10-03T12:53:25.000Z (about 9 years ago)
- Last Synced: 2025-06-04T12:53:22.178Z (7 months ago)
- Language: Python
- Size: 9.77 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Bit Array
[](https://travis-ci.org/bmoscon/bit_array)
[](LICENSE)
A simple bit array in pure python. Sample use:
```
b = BitArray(64)
b[0] = 1
b[1] = 0
```
You can also initialize with a list:
```
b = BitArray([0,1,0,1,0,1,0,1])
print(b[1])
>>> 1
```
You can also access parts of the array with slice operations:
```
sliced = b[0:4]
print(sliced[1])
>> 1
len(sliced)
>>> 4
```