我想将十六进制值添加到二进制字符串中,以便最终得到可以传输的二进制字符串。我想要的是:(
StringToAppend = "5ce7e615ff0000000000010202041f0140009e005d006404084c5ce82215ff1d02000000010202041f013b0097005c005e04777c"
我有这个未十六进制的形式,并想将它附加到一个字符串StatusStr = chr(0)
中我该怎么做???这就是我所拥有的:
>>> not_macs_buffer= unhexlify("5ce7e615ff0000000000010202041f0140009e005d006404084c5ce82215ff1d02000000010202041 f013b0097005c005e04777c")
>>> StatusStr = chr(0)
>>> for i in xrange(0,len(not_macs_buffer)):
... StatusStr +=chr(not_macs_buffer[i])
...
Traceback (most recent call last):
File "<stdin>", line 2, in <module>
TypeError: an integer is required
>>>