I would like to convert a bytearray in Python 3 in binary data in order to manipulate them.
For example, let's assume that we have the following:
a = bytearray(b'\x10\x10\x10')
Then:
a) I would like to display a in its binary form, such as
b = 0b100000001000000010000.
b) I would like to be able to select some bits from the previous data (where the least significant bit would correspond to b[0] somehow), e.g., b[4:8] = 0b0001 .
How can we do that in Python?