I am trying to iterate a list and then save it to a file .txt
with open/write
.
lista = ['uno', 'dos', 'tres']
mi_path = "../fichero.txt"
f = open(mi_path, 'a+')
for i in lista:
f.write(i)
f.close()
I give the attribute a+
to re-write the file .txt
and continue from the last position, the problem is that only saves me the first item in the list. When doing the for
loop what I want is for you to register the 3 fields of the list that I am giving you, but only do it with the first one.