1
I want to modify just one line of a file, something like that
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 must load the entire 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 I perform the function.
The only difference to what I want is I don’t intend to write in another file.
– Lucas Caresia