Xie&Tian wrote:
Hi
When I use struct to pack binary data, I found this interesting behaviour:
import struct
struct.pack('B', 1)
'\x01'
struct.pack('H', 200)
'\xc8\x00'
struct.pack('BH',1, 200)
'\x01\x00\xc8\x00'
struct.calcsize('BH')
4
Wh
Hi
When I use struct to pack binary data, I found this interesting behaviour:
>>> import struct
>>> struct.pack('B', 1)
'\x01'
>>> struct.pack('H', 200)
'\xc8\x00'
>>> struct.pack('BH',1, 200)
'\x01\x00\xc8\x00'
>>> struct.calcsize('BH')
4
Why does "struct.pack('BH',1, 200)" come out with an ext