struct.Struct.pack()

pack(v1, v2, ...) Identical to the pack() function, using the compiled format. (len(result) will equal size.)

struct.Struct.format

format The format string used to construct this Struct object.

struct.Struct.pack_into()

pack_into(buffer, offset, v1, v2, ...) Identical to the pack_into() function, using the compiled format.

struct.Struct.iter_unpack()

iter_unpack(buffer) Identical to the iter_unpack() function, using the compiled format. The buffer’s size in bytes must be a multiple of size. New in version 3.4.

struct.Struct.unpack()

unpack(buffer) Identical to the unpack() function, using the compiled format. The buffer’s size in bytes must equal size.

struct.Struct.size

size The calculated size of the struct (and hence of the bytes object produced by the pack() method) corresponding to format.

struct.calcsize()

struct.calcsize(fmt) Return the size of the struct (and hence of the bytes object produced by pack(fmt, ...)) corresponding to the format string fmt.

struct.pack_into()

struct.pack_into(fmt, buffer, offset, v1, v2, ...) Pack the values v1, v2, ... according to the format string fmt and write the packed bytes into the writable buffer buffer starting at position offset. Note that offset is a required argument.

struct.iter_unpack()

struct.iter_unpack(fmt, buffer) Iteratively unpack from the buffer buffer according to the format string fmt. This function returns an iterator which will read equally-sized chunks from the buffer until all its contents have been consumed. The buffer’s size in bytes must be a multiple of the size required by the format, as reflected by calcsize(). Each iteration yields a tuple as specified by the format string. New in version 3.4.

struct.pack()

struct.pack(fmt, v1, v2, ...) Return a bytes object containing the values v1, v2, ... packed according to the format string fmt. The arguments must match the values required by the format exactly.