[plum] Utility Reference: unpack_from()

plum.unpack_from(fmt, buffer, offset=None)

Unpack item from within a bytes buffer.

  • fmt (Plum, tuple of Plum, or dict) – plum type, tuple of types, or dict of types
  • buffer (bytes-like (e.g. bytes, bytearray, memoryview) or binary file) – bytes buffer
  • offset (int) – starting byte offset (None indicates current file position)

unpacked items

Return type:

Plum, tuple of Plum, or dict of Plum (dependent on fmt)


UnpackError if insufficient bytes or value error

For example:
>>> from plum import unpack_from
>>> from plum.int.little import UInt8
>>> buffer = b'\x99\x01\x99'
>>> offset = 1
>>> unpack_from(UInt8, buffer, offset)