2d numpy array to text file -
i have 3d-array storing temperature data. , me want put text file in 1 single line. need re-write code in pythonic way.
jn in range(x1, x2): jm in range(y1,y2): fl.write(str((t[jn,jm] - 273.1).astype(int))+" ") fl.write("\n")
assuming array save t
:
t.tofile('yourfile.txt',sep=" ",format="%s")
also see question:
Comments
Post a Comment