Discuss / Python / 交个作业

交个作业

Topic source
import struct

def bmp_check(filename):
    f = open(filename,'rb')
    s = f.read(30)
    t = struct.unpack('<ccIIIIIIHH',s)
    if t[0]==b'B' and t[1]==b'M':
        return t[6],'*',t[7]),' ', str(t[9])
    else:
        return "It's not a bmp file!"

  • 1

Reply