There is an example where we first encode a sequence and then decode it. But in this case, the output is not the expected 'A I', but the different results (depending on the encoding) are not one of which is not correct. Tell me how to fix?
secret='A я' bit_list = '' byte_array = [] for byte in secret.encode('cp1251'): print(byte) for bit in bin(byte)[2:].zfill(8): bit_list += bit if len(bit_list) == 8: byte = int(bit_list, 2) print(byte) byte_array.append(byte) bit_list = '' print(byte_array) for byte in byte_array: print(str(chr(byte)))