"Francis Girard" <[EMAIL PROTECTED]> wrote:

> I have an ISO-8859-1 file containing things like
> "Hello\u000d\u000aWorld", i.e. the character '\', followed by the
> character 'u' and then '0', etc.
> 
> What is the easiest way to automatically translate these codes into
> unicode characters ?
> 

>>> s = r"Hello\u000d\u000aWorld"
>>> print s
Hello\u000d\u000aWorld
>>> s.decode('iso-8859-1').decode('unicode-escape')
u'Hello\r\nWorld'
>>> 

-- 
Duncan Booth http://kupuguy.blogspot.com
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to