I want to serialize a few variables into an array of bytes. My problem is that this serialziation has to be done with different values of bits. For example. Member 1 -> 4 bits Member 2 -> 1 bit Memebr 3 -> 32 bits
I have tried struck.pack solution and bitstring solutions but its not possible work with bits, only 8 multiples values:
s = BitArray()
s.append('0x000001b3') # the sequence_header_code
s.append('uint:12=352') # 12 bit unsigned integer
s.append('uint:12=288')
But this is not an easy way to work with large structures as I need. Any better solution? Tags python bit serialization