python 读取blob
for num in range(76802): # if num == 0: # c[num] = imagedata[0:4] # d[num] = struct.unpack('i', c[num]) # elif num == 1: # c[num] = imagedata[4:8] # d[num] = struct.unpack('i', c[num]) # else: # c[num] = imagedata[8:12] # c[num] = imagedata[10:12] # d[num] = struct.unpack('4s', c[num]) #c[num] = imagedata[(num-1)*2+6:(num-1)*2+10] if num == 3 : c[num] = imagedata[1000:1002] d[num] = struct.unpack('h', c[num]) print(c[num]) print(d[num])
imageData即blob类型。
利用struct包的unpack方法。其中参数参照下表: