Have you tried bitarray[1]?
It was that easy? Man. Looking forward to giving these a shot...
Re:Working with Binary Data in Python
by tonyarkles on Monday December 07, 2015 @03:57PM
(#10692635)
I've used it quite heavily to parse data that comes in 85- and 1275-bit chunks and it works awesome.
Edit: sorry, it was bitstring, not bitarray. bitstring.BitArray :).
Obligatory XKCD: https://xkcd.com/353/
+1 from me. Excellent library
Why couldn't I figure this out by myself?! Thanks!
What I mean by that is I literally have data stored in memory, and I want to deal with it in arbitrary groups of bits.
Sometimes 1 bit, sometimes 7 bits, rarely 13 bits.
My Google's haven't turned up much precedent.
</off topic complaint>