【发布时间】:2015-08-02 11:17:39
【问题描述】:
我读了一些二进制列
dtype = ['<f8', '<f8', '<i4']
raw = np.fromfile(file_id, dtype=dtype, count=n_col)
f0 = raw[0]
f1 = raw[1]
i0 = raw[2]
现在我只有numpy 数组f0、f1、i0。我如何以同样的方式将它们写入二进制文件。试过了
np.array([f0, f1, i0]).tofile(file_id) # Promotes my int32 to double
np.array(tuple([f0, f1, i0]).tofile(file_id) # Does something writing a lot of data, but I have no idea in what structure
任何帮助都将不胜感激。
【问题讨论】:
标签: file python-3.x numpy