convert string to the escaped string

2005-11-12 Thread Petr Jakes
Hi, I am trying to convert string to the escaped string. example: from 0xf I need \0xf I am able to do it like: a=0xf escaped_a=(\%s % a ).decode(string_escape) But it looks a little bit complicated in this beautiful language to me Regards Petr Jakes -- http://mail.python.org/mailman

Re: convert string to the escaped string

2005-11-12 Thread Petr Jakes
small mistake in my previous posting, sorry from 0xf I need \xf of course and mentioned code gives me \0xf of course. Thanks for your postings Petr Jakes -- http://mail.python.org/mailman/listinfo/python-list

Re: convert string to the escaped string

2005-11-12 Thread Fredrik Lundh
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: a=0xf 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

Re: convert string to the escaped string

2005-11-12 Thread Petr Jakes
Fredrik, thanks for your posting. I really appretiate your reply and your way how you kindly answer even stupid newbie's questions on this mailing list. I was trying: int(0xf) but I did not have idea about the optional base parameter for the int function. Thanks a lot. Petr --