Discuss / Python / 交作业

交作业

Topic source

執謎卜誤

#1 Created at ... [Delete] [Delete and Lock User]
with open('test.bmp','rb') as fn:
    fn = fn.read()
    f = struct.unpack('<ccIIIIIIHH',fn[0:30])
    if (f[0] == b'B') & (f[1] == b'M'):
        print('It\'s Windows BMP file\nhigh:%s weight:%s \nThe Colornumbers:%s' % (f[6],f[7],f[8]))

  • 1

Reply