How can I iterate and evaluate the value of each bit given a specific binary number in python 3?
For example:
00010011
--------------------
bit position | value
--------------------
[0] false (0)
[1] false (0)
[2] false (0)
[3] true (1)
[4] false (0)
[5] false (0)
[6] true (1)
[7] true (1)
0and1characters)?[ bool(int(x)) for x in "00010011" ]would yield[False, False, False, True, False, False, True, True]. Is this what you aim for?bin()will never give you leading0s. And it'll be prefixed with0b.