binary(num)

Transform a number to a binary format as string (3 => '00000011')

Parameters:
  • num (float) –

    number to transform

Returns:
  • str

    String representing num

unpack(buffer, formt, position)

Unpack a number of values from buffer beginning at position.

Parameters:
  • buffer (bytes) –

    Buffer to extract values.

  • formt (str) –

    values format from struct package.

  • position (int) –

    position to begin.

Returns:
  • tuple[int, tuple[Any, ...]]

    New unread position after extract the fields and tuple of fields.