convert string to the "escaped string"
fredrik at pythonware.com
Sat Nov 12 15:27:18 CET 2005
Petr Jakes wrote:
> I am trying to convert string to the "escaped string".
> example: from "0xf" I need "\0xf"
> I am able to do it like:
> escaped_a=("\%s" % a ).decode("string_escape")
> But it looks a little bit complicated in this beautiful language to me
I suspect that optimizing for people who want to turn "0xf" into
chr(0) + "xf" isn't exactly a priority...
if that's really what you want, of course. are you sure you didn't
mean to write, say
(that is, convert 0xf to a character) or
(that is, convert 0xf to a character, and convert that character to a
More information about the Python-list