I'm learning Python and I've been creating txt files, adding things and rewriting them but I have not been able to modify a specific line, how can I do that? and I also wanted to know how to find out what line a string specifies this, I can already search but I could not make the program discover the line where the string is: |
To search I've uploaded using ...
palavra = input('palavra a pesquisar ')
for line in open('perfil.txt'):
if palavra in line:
print(line)