I'm trying to send some bytes from Python. I'm using struct.pack
to get the corresponding sending bytes. For example:
>>> struct.pack('BBBBBh', 200, 0, 56, 6, 0, 6)
'\xc8\x008\x06\x00\x00\x06\x00'
If you take a close look, you can see that the second byte (that sould be \x00
) has been merged with the next byte (that should be \x38
).
In fact, if I try to concatenate by text:
>>> '\x00' + '\x38'
'\x008'
The same thing happens.
I need to have '\x00\x38'
. Is this possible? Am I missing something related to formats or whatsoever?