Wow!
That explains so much, thanks! I've written my own snippet, much like yours:
import re
foo = open("PREFIX.txt", "r+")
text = foo.read
foo.close()
special = re.compile(r"\\")
def escape(match):
return "\\" + match.group(0)
if __name__ == "__main__":
out = open("WRITE.txt", "w")
out.write(str(text))
out.write(special.sub(escape, text))
out.close()
The following error appears, however(I am running it via the command console):
TraceBack (most recent call last):
File "advanced,py", line 15, in (module)
out.writeout.write(str(special.sub(escape, text)))
TypeError: expected string or buffer
I've also tried to use it run it while line 15 looked like this: out.write(special.sub(escape, text))
I have only started using Python yesterday, but the company needs me to use it now, for this, so please bear that in mind...
Thank you for the help, hopefully you can assist withthis as well.