代码
# code for judge a segy file IEEE or IBM format = 'nothing' fileName = "vp_marmousi-ii.segy" fSegy = open(fileName,"rb") fSegy.seek(3225,0) tempValue = fSegy.read(1) hexValue = tempValue.hex() decValue = int(hexValue,16) if decValue == 1: format = 'IBM' else: if decValue == 5: format = 'IEEE' print(format) # 1=4字节IBM浮点数 # 2=4字节,两互补整数 # 3=2字节,两互补整数 # 5=4字节IEEE浮点数