使用struct modu压缩十六进制字符串

2024-09-27 21:22:37 发布

您现在位置:Python中文网/ 问答频道 /正文

我需要使用struct module将'4EA7'的十六进制字符串打包为2bytes,我做了如下工作:

struct.pack('<H',int('4EA7',16))
'\xa7N'

问题是它为什么不返回\x4E\xA7?在

谢谢


Tags: 字符串structpackintmodulexa7x4exa7n

热门问题