Good morning!
I have a project that I am improving and would like to do a For i to run all the variables within the project, however when running it applies the project only to the last variable.
Code:
for i in ['1', '2', '3']:
arquivo5 = open(r'\Texto para SAS\Vers' + str(i) + '.txt', 'w')
with open(r'\DataMining Python\Respostas.txt') as stream:
with open(r'\Texto para SAS\teste.txt', 'r') as arq:
palavras = arq.readlines()
for line in stream:
for word in palavras:
if word.lower() in line.lower():
a = (line.strip(), '¬', word + '\n\r')
arquivo5.writelines(a)
print(i)
arquivo5.close()
Response.txt:
Muita cobranca para meu time
Cobrar nao e viver
Nao me cobre por isso
test.txt
cobra
cobranca