#!/usr/bin/env python3 # -*- coding: utf-8 -*- import struct def check_bmp(filename): with open(filename, 'rb') as f: header = f.read(30) s = struct.unpack('<ccIIIIIIHH', header) if s[0] == b'B' and s[1] in b'MA' and s[3] == 0 and s[8] == 1: print(s) else: print('error') check_bmp('test.bmp')
Sign in to make a reply
冬凉默殇