0
file text replacement
is it possible to access a .txt file and replace all "t" with "a" with open('file.txt', 'r') as f: with open('file.txt', 'w') as w: for t in f.read(): if "t" in t: w.write("a")
1 Réponse
+ 1
- read the text
- change the text (e.g. using .replace())
- save the text
https://www.w3schools.com/JUMP_LINK__&&__python__&&__JUMP_LINK/ref_string_replace.asp