I want to write a text file where many lines are created, so I want to know how to put each value on a new line.
this is my code:
import itertools
from itertools import permutations , combinations
lista=[]
splits=itertools.permutations('0123456789', 5)
for x in splits:
lista.append(x)
f=open('lala.txt', 'w')
for i in lista:
f.write(str(i))
in this part I need to put the line break: f.write(str(i))
I have tried with: f.write(str(i)\n) but gives me an error
You can use:
f.write(str(i) + '\n')