I have a for loop in Python and in every iteration I would like to write the result to a new text file.
import numpy as np
n = 5
g = my_func()
for i in range(n):
""" I wan to have test0.txt for i = 0
test1.txt for i = 1 and so on ...
"""
f = open('test.txt','ab')
np.savetxt(f, g, fmt='%.0f', newline=" ")
f.close()
Is this possible?
My real value of n is 1000