在Python中,我经常使用以下序列从字节缓冲区中获取整数值(在python中这是一个str).
我从struct.unpack()例程中获取缓冲区.当我用'解压''char'时
byte_buffer, = struct.unpack('c', raw_buffer) int_value = int( byte_buffer.encode('hex'), 16 )
有没有更好的办法?
python byte types integer
byte ×1
integer ×1
python ×1
types ×1