标签:length str ack 问题 unp 示例 time 错误 except
rObjBuff = "".join(unpack(‘=%ds‘ % ObjLen, recv_buf[6+i*ObjLen:6+(i+1)*ObjLen]))
score, bbox1, bbox2, bbox3, bbox4, p00, p01, p10, p11, p20, p21, p30, p31, p40, p41 = unpack(‘=5f10H‘, rObjBuff)
错误示例:
rObjBuff = unpack(‘=%ds‘ % ObjLen, recv_buf[6+i*ObjLen:6+(i+1)*ObjLen])
score, bbox1, bbox2, bbox3, bbox4, p00, p01, p10, p11, p20, p21, p30, p31, p40, p41 = unpack(‘=5f10H‘, rObjBuff)
此时第二次unpack报错:ocr_recognize timeout , exception:unpack requires a string argument of length 40
,因为rObjBuff此时是tuple元组,而不是list,所以要"".join进行转换。
python——unpack问题 ocr_recognize timeout , exception:unpack requires a string argument of length 46
标签:length str ack 问题 unp 示例 time 错误 except
原文地址:http://www.cnblogs.com/zl1991/p/7246989.html