[Numpy-discussion] wrapping arrays with savetxt

Andreas lists at hilboll.de
Fri Apr 23 04:16:47 EDT 2010


Hi there,

I would like to use savetxt() to write a 2d array to a txt file. It 
should be written row-wise, but there should only be 10 values per line.

So, if I want to write an array a((2,12)), the file should read like this:

X X X X X X X X X X
X X

X X X X X X X X X X
X X

Is there any way to accomplish this? I thought I could iterate over the 
rows (with for), and use savetxt on each row individually. But then 
there's still the problem of wrapping.

Since in the end the files are going to be pretty big (1440x2880), it 
would be good to do this as efficiently as possible ...

Thanks for your insight,

Andreas



More information about the NumPy-Discussion mailing list