I do some calculations after reading the file and want to save the result (one number) to another file. I want to be able to do things with this file later. I'm having trouble saving the result in a text file.
I tried this:
c = fdata_arry[:,2]*fdata_arry[:,4] d = np.sum(c) print d f = open('test','w') f.write(d) f.close()
which gives me this error for f.write(d) :
An asymmetric array cannot be interpreted as a character buffer
I also tried using np.savetxt('test.dat',d) , but this gives me:
IndexError: tuple index out of range
Any idea how I can solve this? Note that d is just one value, which is the sum of several numbers.
Rafat source share