Interpreting string containing \u000a
__peter__ at web.de
Wed Jun 18 14:21:18 CEST 2008
Francis Girard 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 ?
If the file really contains the escape sequences use "unicode-escape" as the
If it contains the raw bytes use "iso-8859-1":
Open the file with
instead of the builtin open().
More information about the Python-list