作业
Topic source这个有点不严谨,因为拿个jpg也会被认为是可以的,稍改了下: import struct def bmpinfo(file): try: with open(file,'rb') as f: s = f.read(30) info = struct.unpack('<ccIIIIIIHH',s) if info[0] == b'B' and info[1] == b'M': return info[2],info[6],info[7] else: raise BaseException except BaseException: print(file+' is not a bmp file')
- 1
meiji5750_fce572