input:
print(struct.pack("b", 0)
print(struct.pack("b", 0))
print(struct.pack("I", 3))
print(struct.pack("I", 0))
print(struct.pack("I", 0))
print((struct.pack('bbIII', 0, 0, 3, 0, 0)))
output:
b'\x00'
b'\x00'
b'\x03\x00\x00\x00'
b'\x00\x00\x00\x00'
b'\x00\x00\x00\x00'
b'\x00\x00\x00\x00\x03\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
Singed chars at the last row are returning 2bytes for some reason.I don't understand why the last bytearray is returning the longer value than what I expect, I would like to know a reason and a solution of it. Thanks.