如何将长二进制字符串转换为 python 中的整数? (基础 > 36)
How to convert a long binary string to an integer in python? (base > 36)
我有一个长度为 128 的位串,想对其执行按位与运算。为此,我想首先将位串转换为整数。
int("00000010000....0000000",128)
但是python报错:
ValueError: int() base must be >= 2 and <= 36
我的问题是如何将长位字符串转换为 Python 中的整数?或者有没有其他方法可以在不将位字符串转换为整数的情况下执行按位与运算?
我有一个长度为 128 的位串,想对其执行按位与运算。为此,我想首先将位串转换为整数。
int("00000010000....0000000",128)
但是python报错:
ValueError: int() base must be >= 2 and <= 36
我的问题是如何将长位字符串转换为 Python 中的整数?或者有没有其他方法可以在不将位字符串转换为整数的情况下执行按位与运算?