I have a 2d array and i want to write it to a file, the array looks almost like this:
>>print (arr)
[0 0 20
0 5 520
2 0 720
....
8 -20 150
0 10 10]
when i tried to write it to a file it was saved as the last output, here what i used:
ff = open('output.txt', 'w')
ff.write(arr)
this was the result in the file
[0 0 20
0 5 520
2 0 720
....
8 -20 150
0 10 10]
i saw a solution in another question in this website but still i have a problem,
np.ndarray.tofile(arr,"output.txt",'\n','%s')
the output in the file was like this :
0 0 20 0 50 ...
and so on till the end of the array
i want the output to look like this:
0 0 20
0 5 520
2 0 720
.
.
.
8 -20 150
0 10 10