2024-09-27 21:22:37 发布
网友
我需要使用struct module将'4EA7'的十六进制字符串打包为2bytes,我做了如下工作:
4EA7
struct.pack('<H',int('4EA7',16)) '\xa7N'
问题是它为什么不返回\x4E\xA7?在
\x4E\xA7
谢谢
你要找的是:
In [1]: struct.pack('>H',int('4EA7',16)) Out[1]: b'N\xa7'
https://ascii.cl/中的\x4E是字母'N'一个A7按原样打印。在
\x4E
'N'
A7
你要找的是:
https://ascii.cl/中的
\x4E
是字母'N'
一个A7
按原样打印。在相关问题 更多 >
编程相关推荐