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

Popular posts from this blog

java - Suppress Jboss version details from HTTP error response -

gridview - Yii2 DataPorivider $totalSum for a column -

Sass watch command compiles .scss files before full sftp upload -