I have a matrix named t
. I want to write it into a text file row by row. Also, each element in the matrix has a same format, for example 10.3f
. The problem is that each row has 48 elements that I cannot write explicitly.
I tried to use {f}*{}
:
for i in range(len(t[0][:])) :
result.write( "'{8.3f}'*{per}\n".format( t[:][i],per=len(t[:][i]) ) )
I got the error as follow:
IndexError: tuple index out of range