"Tor Erik Sønvisen" <[EMAIL PROTECTED]> wrote:
> How can I transform b so that the assertion holds? I.e., how can I
> reverse the backslash-replaced encoding, while retaining the str-type?
>
a = u''
b = a.encode('ascii', 'backslashreplace')
b
> '\\xe6'
assert isinstance(b, st
Hi,
How can I transform b so that the assertion holds? I.e., how can I
reverse the backslash-replaced encoding, while retaining the str-type?
>>> a = u'æ'
>>> b = a.encode('ascii', 'backslashreplace')
>>> b
'\\xe6'
>>> assert isinstance(b, str) and b == 'æ'
Traceback (most recent call last):
F