I'm trying to develop a program, which does the following:
From 1 to 100, it writes the word "test" in a text file.
And after that, I want it to match the word "test" WITH EACH LINE with its lines from another text file.
I ran the program, and it wrote 100 lines with the word "test", however, I do not know how to join with each line of the other file.
HowdoImergewitheachlineofthisothertextfile?
Asaresultthis(Ididnotmakeupto100,becauseitisverylaborious):
Mysourcecode:
arquivo=open('arquivo_teste.txt','w')outro_arquivo=open('letrasaleatórias.txt','w')foriinrange(0,100):"""
Preciso escrever em cada linha "teste" + o conteúdo de cada linha do outro arquivo.
No caso, "outro_arquivo", ali de cima.
"""
arquivo.writelines('teste')
# Usei para dar espaço(um embaixo do outro) e não ficar deste jeito:
# testetestetestetestetestetestetestetestetestetesteteste
arquivo.write('\n')
arquivo.close()
outro_arquivo.close()