On 23 Dec 2004 18:41:57 -0800, rumours say that [EMAIL PROTECTED]
might have written:

>I have several ascii files that contain '\ooo' strings which represent
>the octal value for a character. I want to convert these files to
>unicode, and I came up with the following script. But it seems to me
>that there must be a much simpler way to do it. Could someone more
>experienced suggest some improvements?

(hope I cancelled the previous off-by-one-backslash post...)

your_string = "\\326du"
decoded_string = your_string.decode("string_escape")
unicode_text = unicode(decoded_string, "latin-1")
-- 
TZOTZIOY, I speak England very best.
"Be strict when sending and tolerant when receiving." (from RFC1958)
I really should keep that in mind when talking with people, actually...
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to