How to print string in data file ? I have checked this Python Print String To Text File. But this is not really helping me. The part of the code is like this :
for k in range(len(energy)):
str = "%12.4e %12.4e " %(energy[k], spectra[0][k])
for j in range(1,spectra.shape[0]):
str += "%12.4 " % spectra[j][k]
print str
Now i want this string output in a data file. How this can be done ? Any help is appreciated.