with open('Test.bmp', 'rb') as f: s = f.read(30) #利用struct提取信息 struct.unpack('<ccIIIIIHH',s) #报错 #struct.error: unpack requires a buffer of 26 bytes 原因是,unpack函数的第一个参数中少写了一个I(4字节),导致处理的数据大小为26Bytes,而s为30Bytes. 修改为: struct.unpack('<ccIIIIIIHH',s) (b'…
[libprotobuf ERROR google/protobuf/wire_format.cc:1053] String field contains invalid UTF-8 data when serializing a protocol buffer. Use the 'bytes' type if you intend to send raw bytes. 原因是中间,用char[]把它截断了,造成utf8字符不完整…