如何在Python上处理包含3字节字的二进制数据?

我需要在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字节单词的解决方法?

liulity5201314 回答:如何在Python上处理包含3字节字的二进制数据?

暂时没有好的解决方案,如果你有好的解决方案,请发邮件至:iooj@foxmail.com
本文链接:https://www.f2er.com/3055767.html

大家都在问