interpretation of special characters in Python

TP Tribulations at Paralleles.invalid
Mon Jul 7 05:29:16 EDT 2008


Peter Otten wrote:

>>>> esc = os.environ["esc"].decode("string-escape")
>>>> esc
> '\x1b'
>>>> print "%s[30;44malles so schoen bunt hier%s[0m" % (esc, esc)
> alles so schoen bunt hier

Thanks a lot for your help. It works perfectly.
Indeed, one can read in the documentation concerning encodings:

"Produce a string that is suitable as string literal in Python source code"

-- 
TP (Tribulations Parallèles)

"Allez, Monsieur, allez, et la foi vous viendra." (D'Alembert).



More information about the Python-list mailing list