Pack values and return the packed bytes. Return a bytes object containing the provided values packed according to the format string. See help(struct) for more on format strings.
>>> import struct >>> struct.pack('>h', 1023) b'\x03\xff' >>> struct.pack('<h', 1023) b'\xff\x03'
struct/pack
pack