Hi<br><br>When I use struct to pack binary data, I found this interesting behaviour:<br><br>>>> import struct<br>>>> struct.pack('B', 1)<br>'\x01'<br>>>> struct.pack('H', 200)<br>
'\xc8\x00'<br>>>> struct.pack('BH',1, 200)<br>'\x01\x00\xc8\x00'<br>>>> struct.calcsize('BH')<br>4<br><br>Why does "struct.pack('BH',1, 200)" come out with an extra "\x00"?<br>
<br><br>-- <br>Luyun Xie<br><a href="http://magefromhell.blogspot.com/">http://magefromhell.blogspot.com/</a><br>(<a href="http://blog.hellmage.info/">http://blog.hellmage.info/</a>)<br>