
python3.4里这句话出现了错误,为什么?
ifstruct.unpack("h","\0\1")[0]==1:TypeError:'str'doesnotsupportthebufferinterface...
if struct.unpack("h", "\0\1")[0] ==1:
TypeError: 'str' does not support the buffer interface 展开
TypeError: 'str' does not support the buffer interface 展开
1个回答
展开全部
因为python3 中unpack的第二个参数必须是 bytes类型
if struct.unpack("h",b"\0\1")[0]==1:
if struct.unpack("h",b"\0\1")[0]==1:
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询