python - How to write a ndarry to a structure file with numpy? -
i have 22 * 25 arrays in numpy ar:
0.1 0.0 ..... 0.25 0.2 0.1 ..... 0.0 ... 0.0 0.01.... 0.6 and tried:
ar.tofile("f.txt",sep = " ") what got long string, how can got file 22 rows , 25 columns? thanks.
you better off using np.savetext():
np.savetxt('f.txt', ar, fmt='%.2f')
Comments
Post a Comment