I am working on a problem where I need to manipulate binary data. The easiest way for me to do this would be through arrays as the use of binary string representation is not allowed. I’m able to derive this code or do the same thing using bin() but the numbers will always be converted into a string. I need to use an array of type int or bool. How can this be done?
ascii = list("ABCD".encode('ascii'))
arr = list(map(lambda x: [*format(x, '08b')], ascii))
I tried using bin() and format() to get binary strings in python but got string results.
SwigitySwogity is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.