私信  •  关注

apaderno

apaderno 最近创建的主题
apaderno 最近回复了

在Python 3.7字节中,对象没有 encode() 方法下面的代码不再有效。

import struct

hex_str = struct.pack('2I',12, 30).encode('hex')

而不是 编码() ,Python 3.7代码应使用 hex() 方法,在Python 3.5中介绍。

import struct

# hex_str will contain the '0c0000001e000000' string.
hex_str = struct.pack('2I',12, 30).hex()