我必须'&'两个98长度位消息,但当我输出时包含除1和0之外的数字.有人可以看到我搞砸的地方:
print("The binaryCode of the input message is:", binaryCode)
print("The gsBinary is:", gsBinary)
print(len(gsBinary), len(binaryCode))
newStr = int(gsBinary) & int(binaryCode)
print("The result of anding the gsBinary & binaryCode was:", newStr)
Run Code Online (Sandbox Code Playgroud)
这是运行时的当前输出:
The binaryCode of the input message is: 11001111110010110010111000011110100100000110100011000011110011110100010000011001101110101110111011
The gsBinary is: 11001111110010110010111001011101110110110011000011110111111001111011101111001110010011001011110010
98 98
The result of anding the gsBinary & binaryCode was: 11001111110010110010110999119920984020956932636701193212439574622352446504985730534177701743362082
Run Code Online (Sandbox Code Playgroud)
为什么newStr打印长度为98的字符串,如果两个输入字符串只包含1和0,则值为1&0?