I'm generating an array of Temperature (T) and another array of Position (X) and I'm able to plot it using simple command plt.plot(X, T). However, I'm struggling to get this data output to a text file. Please, can someone help me in this regard? Thank you. The len(T) prints 12 and len(X) prints 12 as well. This is how I'm trying in Python: These are the commands after a while loop, so the data is already generated. I would like to write both T[i] and X[i]
with open('Temp.txt', 'w') as fh: # this is where I like to write my Temperature data
for i in range (12): # trying to loop around all the points, up to 12
fh.write(T[i]) # trying to write temperature to the file, and if it works, need to write the same for the position, X.