Sep-07-2019, 08:20 PM
You should know how to open a textfile.
change the path ( i've used /tmp/test.txt)
change the path ( i've used /tmp/test.txt)
with open("/tmp/test.txt", 'r') as f: text = f.read() f.close() pw = text.partition("password:\n")[2].partition("\nemail:")[0] newpassword = "python" newtext = text.replace(pw, newpassword) print(newtext) with open("/tmp/test.txt", 'w') as f: f.write(newtext) f.close