I want to write the output of my phyton program in a text file. The output is in a loop and I want that each output be in one line. I am using this code for writing, but still I will give all the result in one line.
with open('temp.txt', 'w') as outfile:
out = P2[16:3276,:].sum(axis=0)
outfile.write("{}\n".format(out))
The actual result is:
[ 0. 0. 0. ..., 0. 0. 0.]
But I want to be like this:
0
0
0
0
0
0