BitVector操作不可能

时间:2016-08-09 15:09:25

标签: python python-3.x bitvector

我想在两个BitVectors上执行xor操作。在尝试将其中一个字符串转换为bitVector然后进入xor操作时,我收到以下错误:

ValueError: invalid literal for int() with base 10: '\x91'

如何绕过这个问题?我只想要两个表达式,但其中一个是字符串,它需要先转向bitvector吗?但是,尝试将字符串转换为BitVector会产生上述错误。

    to_be_xored = BitVector.BitVector(bitstring= variable)

其中variable是字符串,to_be_xored是所需的Bitvector。

1 个答案:

答案 0 :(得分:2)

bitstring适用于'0''1' s的序列。要使用文字,请改用textstring