python - Bool array to integer -
is there build in function in python convert bool array (which represents bits in byte) so:
p = [true, true, true, false, true, false, false, true]
into byte array this:
bp = bytearray([233])
i aware oh numpy looking within python itself
this want:
sum(v<<i i, v in enumerate(p[::-1]))
Comments
Post a Comment