How can I open a file, Stud.txt, and then replace any occurences of "A" with "Orange"?
with open("Stud.txt", "rt") as fin: with open("out.txt", "wt") as fout: for line in fin: fout.write(line.replace('A', 'Orange'))
1.4m articles
1.4m replys
5 comments
57.0k users