问题:我想得到
(7,5,3) => 000001110000010100000011 => 460035
also the converse, i.e.,
460035 => 000001110000010100000011 => (7,5,3)
这是我尝试过的程序:
L=(7,5,3) # here L may vary each time.
a=0
for i in range(3):
a=bin(a << 8) ^ bin(L[i])
print a
但它给出了错误TypeError: unsupported operand type(s) for ^: 'str' and 'str'
我该怎么做?
呼如林
小怪兽爱吃肉
相关分类