我需要在big-endian主机上读取包含24位little-endian字的二进制数据结构。但是standard Python module struct
seems to only handle 1-,2-,4- and 8-byte words。
这是示例数据帧的转储:
7F 01 00 00 02 00 00 76 DE 77
-- -------- -------- ----- --
| | | | |
| | | | |
| | | | \ End of frame
| | | |
| | | \ 16 bits checksum
| | |
| | \ Second 24 bits word
| |
| \ First 24 bits word
|
\ Start of frame
是否存在一种使用struct
读取3字节单词的解决方法?