سؤال

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