copapy.pack#
- copapy.pack(fmt, *values)#
Convert numbers or copapy values to their bytes, like struct.pack.
The format is a struct format string limited to 32 bit types: ‘b’ and ‘B’ (8 bit int), ‘h’ and ‘H’ (16 bit int), ‘i’ and ‘I’ (32 bit int), ‘f’ (32 bit float) and ‘x’ (pad byte), with optional repeat counts. It starts with ‘<’ for little-endian (default) or ‘>’ for big-endian byte order.
Int values that do not fit into the field are truncated to its lowest bits. Numbers and constants are converted at trace time.