且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何将元素追加到numpy数组

更新时间:2022-06-16 21:57:29

您需要将数组A传递给Numpy.

You need to pass the array, A, to Numpy.

matrix = open('workfile', 'w')
A = np.array([])
for row in matrix:
    A = numpy.append(A, row)

print A

但是,直接从文件加载可能是一个更好的解决方案.

However, loading from the files directly is probably a nicer solution.