0
I have a list and I wanted to write in another file
["AMANDA,"JULIANA","VANESSA","PATRICIA"]
In a document using Python, I managed however the file gets all together like this:
AMANDAJULIANAVANESSAPATRICIA
how could I fix this?
def ordem_txt(palavras):
arq = open(palavras, 'r')
texto = arq.read()
palavras = texto.replace("\n", " ").split(" ")
palavras.sort(reverse=False)
#print(palavras)
return palavras
def write_txt(palavras, caminho):
arq = open(caminho, "w")
arq.writelines(palavras)
arq.close()
Put your code in the question, please.
– Woss
arq.writelines()
does not add line separators, you have to add them to the list items yourself.– hdiogenes