Skip to main content
Stack Overflow
  1. About
  2. For Teams

Return to Revisions

2 of 2
added 2 characters in body

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)

AltStyle によって変換されたページ (->オリジナル) /