私信  •  关注

Artem Zankovich

Artem Zankovich 最近创建的主题
Artem Zankovich 最近回复了

有一个选项可以将字节数组转换为十六进制字符串 encode 。它适用于Python 2.4中的任何Python:

Python 2.7.12 (default, Oct 10 2016, 12:50:22)
>>> import struct
>>> struct.pack('2I',12, 30).encode('hex')
'0c0000001e000000'
>>> struct.pack('2I',12, 31).encode('hex')
'0c0000001f000000'
>>> struct.pack('2I',12, 32).encode('hex')
'0c00000020000000'
>>> struct.pack('2I',12, 33).encode('hex')
'0c00000021000000'