This refers to a subset of CPython's struct:
https://docs.micropython.org/en/latest/ ... ule-struct
But the doc does not explain, that the byte order could be only the first character in the format string.
CPython-Docs: https://docs.python.org/3/library/struc ... -alignment
https://docs.micropython.org/en/latest/ ... ule-struct
But the doc does not explain, that the byte order could be only the first character in the format string.
CPython-Docs: https://docs.python.org/3/library/struc ... -alignment
Furthermore, if you scroll down, you'll find following:Alternatively, the first character of the format string can be used to indicate the byte order, size and alignment of the packed data, according to the following table:
This means in your case, you could just use "!6H" as format:A format character may be preceded by an integral repeat count. For example, the format string '4h' means exactly the same as 'hhhh'.
Code:
[deadeye@nexus build-standard]$ ./micropython MicroPython v1.27.0-preview.107.gd1607598f.dirty on 2025-09-09; linux [GCC 15.2.1] versionUse Ctrl-D to exit, Ctrl-E for paste mode>>> import struct>>> struct.unpack("!6H", bytearray([0]*12), 0)(0, 0, 0, 0, 0, 0)>>> Statistics: Posted by DeaD_EyE — Tue Sep 09, 2025 7:06 pm