infile = open("session-1/rfc1819.txt") text = infile.readlines() infile.close() text = "".join(text) text = text.replace("EMail", "AMail") print(text) outfile = open("session-1/AMail.txt","w") outfile.write(text) outfile.close()