I am trying to solve this issue.
I have a list like that:
g = ['hey','man','sup']
and i want 3 different text files like "hey.txt","man.txt","sup.txt".
I used;
f = open('hey.txt','w')
sys.stdout = f
....
but is there a way to do it like that?;
for x in range(3):
f = open('g[x].txt','w')