import struct def bmpinfo(file): with open(file,'rb') as f: b=f.read(30) i=struct.unpack('<ccIIIIIIHH',b) if i[1]==b'M': os='windwos' else: os='OS/2' print('该文件是由%s系统创建,为分辨率%s * %s %s位图片' % (os,i[6],i[7],i[9]))
Sign in to make a reply
ColinShi2011
import struct def bmpinfo(file): with open(file,'rb') as f: b=f.read(30) i=struct.unpack('<ccIIIIIIHH',b) if i[1]==b'M': os='windwos' else: os='OS/2' print('该文件是由%s系统创建,为分辨率%s * %s %s位图片' % (os,i[6],i[7],i[9]))