首页 > 解决方案 > Numpy fromfile io.UnsupportedOperation

问题描述

当我尝试使用 读取二进制文件numpy.fromfile时,我收到一条错误消息io.UnsupportedOperation: seek

我在用Python 3.7.1

with open(filename, 'rb') as fin:
    prolog = np.fromfile(fin, dtype=np.int32, count=15)

标签: pythonpython-3.xnumpy

解决方案


这更简单,绝对应该有效:

prolog = np.fromfile(filename, dtype=np.int32, count=15)

推荐阅读