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

Popular posts from this blog

matlab - "Contour not rendered for non-finite ZData" -

delphi - Indy UDP Read Contents of Adata -

javascript - Any ideas when Firefox is likely to implement lengthAdjust and textLength? -