What's this Comment utiliser savetxt (), une fonction qui enregistre ndarray dans un fichier, en mode ajout.
savetxt.py
import numpy
a = [[3, 4, 5], [6, 7, 8], [9, 10, 11]]
nda = numpy.array(a)
a2 = [[-3, -4, -5], [-6, -7, -8], [-9, -10, -11]]
nda2 = numpy.array(a2)
with open('output.txt', 'a') as f_handle:
numpy.savetxt(f_handle, nda)
numpy.savetxt(f_handle, nda2)
http://stackoverflow.com/questions/17731419/appending-a-matrix-to-an-existing-file-using-numpy http://stackoverflow.com/questions/19793692/strings-and-arraysmatrix-row-wise-numpy-savetxt
Recommended Posts