把a、b、c三个矩阵保存到 test.npy 文件,然后重新读取这个文件。
a = [[1,2]]
b = [[2,3],[3,4]]
c = [[1,2,3],[4,5,6]]
total = []
total.append(a)
total.append(b)
total.append(c)
np.save('./test.npy'), total)
file = np.load('./test.npy'), allow_pickle=True)
print(file[0])
print(file[1])
print(file[2])
结果:
[[1, 2]]
[[2, 3], [3, 4]]
[[1, 2, 3], [4, 5, 6]]