struct.pack 的 fmt 文档
This reference covers Python's struct.pack format strings for hexadecimal protocols. The first character specifies byte order and alignment (e.g., '<' little-endian, '>' big-endian, '!' network order). Type characters map C types to Python types with fixed sizes (e.g., 'B' unsigned char, 'i' int, 'f' float, 's' string with length prefix). Other symbols include 'x' for padding and numbers for repetition. Common combinations and notes on range validation, platform differences, and string handling are included.