I would like to add hexvalues to a binary string so that I end up with a binary string that can be transmitted.
What I want is:
StringToAppend = "5ce7e615ff0000000000010202041f0140009e005d006404084c5ce82215ff1d02000000010202041f013b0097005c005e04777c" (I have this in unhexlified form and want to append it to a string a la StatusStr = chr(0)
How do I do this??? This is what i have:
>>> 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
>>>
TypeError: Non-hexadecimal digit foundwhen I try to runbinascii.unhexlify-- Probably due to the whitespace in there ...StatusStr = chr(0) + unhexlify(...)?