According to the documentation, specifying the byte order removes any padding:
No padding is added when using non-native size and alignment, e.g. with ‘<’, ‘>’, ‘=’, and ‘!’.
Therefore, assuming you require little endian packing, the following gives the required output:
>>> struct.pack('<Hf', id1, i)
'\x01\x00\x18\x1c\x14?'
>>> struct.pack('<Hf', id1, i).encode("hex")
'0100181c143f'
Note the <. (3f can be encoded as ASCII ?, hence the replacement)
According to the documentation, specifying the byte order removes any padding:
No padding is added when using non-native size and alignment, e.g. with ‘<’, ‘>’, ‘=’, and ‘!’.
Therefore, assuming you require little endian packing, the following gives the required output:
>>> struct.pack('<Hf', id1, i)
'\x01\x00\x18\x1c\x14?'
>>> struct.pack('<Hf', id1, i).encode("hex")
'0100181c143f'
According to the documentation, specifying the byte order removes any padding:
No padding is added when using non-native size and alignment, e.g. with ‘<’, ‘>’, ‘=’, and ‘!’.
Therefore, assuming you require little endian packing, the following gives the required output:
>>> struct.pack('<Hf', id1, i)
'\x01\x00\x18\x1c\x14?'
Note the <. (3f can be encoded as ASCII ?, hence the replacement)
According to the documentation, specifying the byte order removes any padding:
No padding is added when using non-native size and alignment, e.g. with ‘<’, ‘>’, ‘=’, and ‘!’.
Therefore, assuming you require little endian packing, the following gives the required output:
>>> struct.pack('<Hf', id1, i)
'\x01\x00\x18\x1c\x14?'
>>> struct.pack('<Hf', id1, i).encode("hex")
'0100181c143f'