Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/328.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 位向量运算不可能_Python_Python 3.x_Bitvector - Fatal编程技术网

Python 位向量运算不可能

Python 位向量运算不可能,python,python-3.x,bitvector,Python,Python 3.x,Bitvector,我想对两个位向量执行异或运算。在尝试将其中一个字符串转换为位向量,然后继续执行xor操作时,出现以下错误: ValueError: invalid literal for int() with base 10: '\x91' 我怎样才能绕过这个问题?我只想对两个表达式进行异或运算,但其中一个是字符串,需要先将其转换为位向量,对吗?但是,尝试将字符串转换为位向量会产生上述错误 to_be_xored = BitVector.BitVector(bitstring= variable)

我想对两个位向量执行异或运算。在尝试将其中一个字符串转换为位向量,然后继续执行xor操作时,出现以下错误:

ValueError: invalid literal for int() with base 10: '\x91'
我怎样才能绕过这个问题?我只想对两个表达式进行异或运算,但其中一个是字符串,需要先将其转换为位向量,对吗?但是,尝试将字符串转换为位向量会产生上述错误

    to_be_xored = BitVector.BitVector(bitstring= variable)

其中,变量是字符串,要异或的是所需的位向量。

位字符串
用于
'0'
s和
'1'
s的序列。要使用文本,请使用
textstring

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