Discuss / Python / 电脑端是little-endian模式,与网络端相反

电脑端是little-endian模式,与网络端相反

Topic source

天命破凰

#1 Created at ... [Delete] [Delete and Lock User]

import base64, struct

def bmp_info(data): s = data[:30] wa = struct.unpack('<ccIIIIIIHH',s) if wa[0] + wa[1] == b'BM': return { 'width': wa[-4], 'height': wa[-3], 'color': wa[-1] } else: print('打开目标文件错误')


  • 1

Reply