write escaped character to file so that the character is visible
<p>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).</p>

<p>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.</p>

<p>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:</p>

<pre><code>v = "\t"
write(v)
</code></pre>

<p>without changing the definition of <code>v</code> (though operations on <code>v</code> are OK)
It seems impossible to change <code>v</code> into "\\t" after it has been defined as "\t".</p>