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:

how write multidimensional array text file?


Comments

Popular posts from this blog

scala - 'wrong top statement declaration' when using slick in IntelliJ -

c# - DevExpress.Wpf.Grid.InfiniteGridSizeException was unhandled -

PySide and Qt Properties: Connecting signals from Python to QML -