# 将矩阵以不同方式存储为txt,文件,尝试一遍就知道其中的不同
import numpy as np
#生成数据2*3的0矩阵
x = y = z = np.ones((2, 3))
print(x)
# 保存数据
#参数的意思:将要保存的路径和新生成的文件,文件名,数据存储格式,分隔符
np.savetxt(rH:WorkSpacespythonmedicine est2 est.txt, x)
np.savetxt(rH:WorkSpacespythonmedicine est2 est1.txt,
x, fmt=%d, delimiter=,)
np.savetxt(rH:WorkSpacespythonmedicine est2 est2.txt, x, delimiter=,)
#行以什么分隔
np.savetxt(rH:WorkSpacespythonmedicine est2 est3.txt, x, newline=a)
np.savetxt(rH:WorkSpacespythonmedicine est2 est4.txt,
x, delimiter=,, newline=a)
#加头
np.savetxt(rH:WorkSpacespythonmedicine est2 est5.txt,
x, delimiter=,, header=abc)
#加尾巴
np.savetxt(rH:WorkSpacespythonmedicine est2 est6.txt,
x, delimiter=,, footer=abc)
print(np.loadtxt(rH:WorkSpacespythonmedicine est2 est1.txt, delimiter=,))
np.loadtxt(rH:WorkSpacespythonmedicine est2 est2.txt, delimiter=,)
print("finished")