append special chars with "\"

Alex Martelli aleax at aleax.it
Tue Sep 30 10:50:19 EDT 2003


Christos TZOTZIOY Georgiou wrote:

> On Tue, 30 Sep 2003 07:58:27 GMT, rumours say that Alex Martelli
> <aleax at aleax.it> might have written:
> 
>>charmap = {}
>>for c in chr: charmap[c] = c+'\\'
> 
> I believe you meant charmap[c] = '\\' + c ...

Sure, if the original poster wants the backslash BEFORE the character
(the "append" in the subject suggested to me he wanted it AFTER).


Alex





More information about the Python-list mailing list