python: unpack IBM 32-bit float point
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I was reading a binary file in python like this: from struct import unpack ns = 1000 f = open("binary_file", 'rb') while True: data = f.read(ns * 4) if data == '': break unpacked = unpack(">%sf" % ns, data) print str(unpacked) when I realized unpack(">f", str) is for unpacking IEEE floating point, my data is IBM 32-bit float point numbers My question is: How can I impliment my unpack to unpack IBM 32-bit float point type numbers? I don't mind using like ctypes to extend python to get better performance. EDIT: I did some searching: http:/