Reading 32 bit signed ieee 754 floating points from a binary file with python?

Deadly 提交于 2019-11-30 06:47:05
struct.unpack('f', file.read(4))

You can also unpack several at once, which will be faster:

struct.unpack('f'*n, file.read(4*n))

Take a peek at struct.unpack. Something like the following might work...

f = struct.unpack('f', data_read)
import struct
(num,) = struct.unpack('f', f.read(4))
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!