📜  如何在 python 代码示例中将 numpy 数组写入文件

📅  最后修改于: 2022-03-11 14:46:23.779000             🧑  作者: Mango

代码示例1
numpy.savetxt(fname, X, fmt='%.18e', delimiter=' ', newline='\n', 
              header='', footer='', comments='# ', encoding=None)


x = y = z = np.arange(0.0,5.0,1.0)
np.savetxt('test.out', x, delimiter=',')   # X is an array
np.savetxt('test.out', (x,y,z))   # x,y,z equal sized 1D arrays
np.savetxt('test.out', x, fmt='%1.4e')   # use exponential notation