PyDocs

Nav

Binary Data Services

Struct

struct

class
  • Struct(format)
Create a compiled struct object.

Return a new Struct object which writes and reads binary data according
to the format string.  See help(struct) for more on format strings.
Changed in 3.13
  • 3.13: The repr() of structs has changed. It is now: >>> Struct('i') Struct('i')
Members of Struct

f

format
struct format string

i

iter_unpack
Return an iterator yielding tuples.

p

pack
Pack values and return the packed bytes.
pack_into
Pack values and write the packed bytes into the buffer.

s

size
struct size in bytes

u

unpack
Return a tuple containing unpacked values.
unpack_from
Return a tuple containing unpacked values.
1 Example
>>> Struct('i')
Struct('i')
from the Python docs
See Also
No see-alsos for struct/Struct
0 Notes
No notes for Struct