问题:如何将array保存到txt文件中?如何将存到txt文件中的数据读出为ndarray类型?...python如何保存矩阵,保存matrix,保存numpy.ndarray
分析
a = np.arange(0,12,0.5).reshape(4,-1)
np.savetxt("a.txt",..., 8.5],
[ 9. , 9.5, 10. , 10.5, 11. , 11.5]])
有些时候会报错:TypeError: Mismatch between...loadtxt适用于1维
?..., 8.5, 9. , 9.5]])
np.savetxt("a.txt",a,fmt="%d",delimiter=",")#改为保存为整数,以逗号分隔
np.loadtxt("a.txt",