struct – pack and unpack primitive data types¶
See Python struct for more information.
Functions¶
-
struct.calcsize(fmt)¶ Return the number of bytes needed to store the given
fmt.
-
struct.pack(fmt, v1, v2, ...)¶ Pack the values
v1,v2, ... according to the format stringfmt. The return value is a bytes object encoding the values.
-
struct.unpack(fmt, data)¶ Unpack from the
dataaccording to the format stringfmt. The return value is a tuple of the unpacked values.