struct.Struct.pack_into

Struct.pack_into(buffer, offset, v1, v2, ...)

Pack the values v1, v2, ... according to this Struct’s format, write the packed bytes into the writable buffer buf starting at offset. Note that the offset is not an optional argument. See struct.__doc__ for more on format strings.