Newbie needs regex help
Peter Otten
__peter__ at web.de
Mon Dec 6 12:12:33 EST 2010
Dan M wrote:
> I'm getting bogged down with backslash escaping.
>
> I have some text files containing characters with the 8th bit set. These
> characters are encoded one of two ways: either "=hh" or "\xhh", where "h"
> represents a hex digit, and "\x" is a literal backslash followed by a
> lower-case x.
By the way:
>>> print quopri.decodestring("=E4=F6=FC").decode("iso-8859-1")
äöü
>>> print r"\xe4\xf6\xfc".decode("string-escape").decode("iso-8859-1")
äöü
More information about the Python-list
mailing list