0
I’m trying to develop a program, which does the following:
From 1 to 100, he writes in a text file the word "test".
And after that, I want him to join the word "test" OF EACH LINE with the respective lines of 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.
How do I join with each line of this other text file?
As a result of that(I did not make up to 100, because it is very laborious):
My source code:
arquivo = open('arquivo_teste.txt', 'w')
outro_arquivo = open('letras aleatórias.txt', 'w')
for i in range(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()
Do you already have both files filled with the 100 lines? Just need to know how to join both the right contents?
– Miguel
That’s right, buddy!!
– BRKappa