为什么不简单地将它们转换成十进制数,然后像处理十进制数那样添加它们:
y = '0b101010' z = '0b101010' print(int(y,2) + int(z,2)) print(bin((int(y,2) + int(z,2))))