'Different result converting binary to ASCII Python

I have a list of binary numbers:

result_xor = ['0b10010000', '0b00010010', '0b00000000', '0b00000000', '0b01100011', '0b00111010', '0b01011100', '0b01110101', '0b01110011', '0b01100101', '0b01110010', '0b01110011', '0b01011100', '0b01110101', '0b01110011', '0b01100101', '0b01110010', '0b00110010', '0b01011100', '0b01100100']

And I want to convert each number to ASCII and concatenate them into a String.

When I use the function to_bytes on just one element it gives me the expected result

c = int(result_xor[6],2)
    a=c.to_bytes((c.bit_length() + 7) // 8, 'big').decode('ISO-8859-1')
    print("ascii",a)

The result is:

ascii \

But, when I try to do it on each element of the list with a for, the msg is empty

msg = ''
for n in range(0,len(result_xor)):
    b = int(result_xor[n],2)
    msg +=b.to_bytes((b.bit_length() + 7) // 8, 'big').decode('ISO-8859-1')
print(msg)

Why does this happen?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source