I want to modify only one line of a file, something like this
with open('arquivo.txt', 'r+') as f:
for line in f.readlines():
if line == algumacoisa:
line.write('textoaqui');
break
f.close()
I saw in another question that to do this you should load the whole file, modify it, and save again, however this is not feasible, because the file has millions of lines, and I do not want to save all the millions of lines every time you run the function.