I am writing a file that contains two vectors (x
and der
):
file = open('derivada.dat','w')
for i in range(n):
file.write(str(x[i]) + ' ' + str(der[i]) + '\n')
file.close()
The .dat
is like this way:
1.0 3.9999999999999973
0.5000000000000001 2.0
-0.4999999999999998 -1.9999999999999973
-1.0 -4.000000000000007
How can I modify my code in order to the file be as following? With the columns perfect align.
1.0 3.9999999999999973
0.5000000000000001 2.0
-0.4999999999999998 -1.9999999999999973
-1.0 -4.000000000000007