size The calculated size of the struct (and hence of the bytes object produced by the pack() method) corresponding to format.
pack_into(buffer, offset, v1, v2, ...) Identical to the pack_into() function, using the compiled format.
pack(v1, v2, ...) Identical to the pack() function, using the compiled format. (len(result) will equal size.)
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.
format The format string used to construct this Struct object.
class struct.Struct(format) Return a new Struct object which writes and reads binary data according to the format string format. Creating a Struct object once and calling its methods is more efficient than calling the struct functions with the same format since the format string only needs to be compiled once. Compiled Struct objects support the following methods and attributes: pack(v1, v2, ...) Identical to the pack() function, using the compiled format. (len(result) will equal size.)
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.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.
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.
exception struct.error Exception raised on various occasions; argument is a string describing what is wrong.
Page 178 of 663