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?
'\\xe6'
Traceback (most recent call last):
File "<pyshell#5 9>", line 1, in <module>
assert isinstance(b, str) and b == 'æ'
AssertionError
Regards,
tores
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 ', 'backslashrepla ce')
>>b
>>b = a.encode('ascii ', 'backslashrepla ce')
>>b
>>assert isinstance(b, str) and b == 'æ'
File "<pyshell#5 9>", line 1, in <module>
assert isinstance(b, str) and b == 'æ'
AssertionError
Regards,
tores
Comment