If I have a char d and a char k, how do I turn each into a bit array (such as True-False-True-True-True-False-False-True) and then combine the arrays into a single array by AND-ing each bit (and then turning the combined array back into a char)? Such as 01100001 (a) and 01100011 (c) combine to make 01100001 (c)? Also, sometimes the results of these conversions are not ASCII (such as 00000010)?

有帮助吗?

解决方案

no need to make an array:

>>> chr(ord('c') & ord('a'))
'a'
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top