My code goes through the compiler but doesn't replace what needs to be replaced in the new file. All files are in the same directory and I've tried running it as ./06_1 but nothing changed. Here is the code. Any help would be appreciated.
def replace_and_chars(fname):
f = open(fname,"r", encoding='windows-1255')
file_buffer_contents = f.read()
file_buffer_contents.replace("&","\\x26")
fout = open(fname.replace(".xml","") + "replaced.xml","w+")
fout.write(file_buffer_contents)
fout.close
f.close()
past = replace_and_chars("06_1.xml")