Thank you very much ! I didn't know about this 'unicode-escape'. That's great!
Francis 2008/6/18 Duncan Booth <[EMAIL PROTECTED]>: > "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 >
-- http://mail.python.org/mailman/listinfo/python-list