Discuss / Python / 作业

作业

Topic source

无虑43793

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

def bmp_info(data): width=None height=None color=None s=data[:30] ss=struct.unpack('<ccIIIIIIHH', s) try: if ss[0]+ss[1]==b'BM' or ss[0]+ss[1]==b'BA': width,height,color=ss[6],ss[7],ss[9] except IndexError: print('not normal bmp!') return { 'width': width, 'height': height, 'color': color }


  • 1

Reply