I want to write "\t" to a file. Not a "tab character", but literally "\t". How do I do this? It has been driving me crazy for more than an hour; everything I try produces an actual "tab character" (empty space).
Why would I want this? Because I'm generating a config file with a ConfigParser() which also includes some delimiters, and I want that file to be human-readable. I do not consider empty space readable.
EDIT: sorry, the problem was not clear: I want to do this for variables that contain strings. So writing "\\t" is not an option. I must write the value of a variable containing an escaped character to a file in a manner ideologically equivalent to:
v = "\t"
write(v)
without changing the definition of v
(though operations on v
are OK)
It seems impossible to change v
into "\\t" after it has been defined as "\t".