I have a job to do but I can not find the error. This excerpt from the program needs to add words to a text file cumulatively. That is, every time you go through the loop you will add numbers and words in the text file without deleting what is already written.
What I've done so far is this:
arqParcial=open("parcial.txt","r")
texto=arqParcial.readline()
f1=[]
for i in range (len(texto)):
palavra=texto[i].split()
f1.append(palavra)
print(f1)
arqParcial.writelines(f1)
arqParcial.close()
But you're giving this error:
Traceback (most recent call last):
File "C:/Python34/teste3.py", line 8, in <module>
arqParcial.writelines(f1)
TypeError: must be str, not list
I have no idea why.
The program is much longer. I just put this section to see if you can tell me why the error.