【发布时间】:2011-04-29 14:23:26
【问题描述】:
嗨,假设我有字符串
test
'\\u0259'
注意转义的反斜杠。
如何将其转换为相应的 unicode 字符串?
【问题讨论】:
嗨,假设我有字符串
test
'\\u0259'
注意转义的反斜杠。
如何将其转换为相应的 unicode 字符串?
【问题讨论】:
>>> print('test \\u0259'.decode('unicode-escape'))
test ə
【讨论】:
print(bytes('test \\u0259', 'ascii').decode('unicode-escape'))。
print的情况下获得符号ə?
bytes('test \\u0259', 'ascii') == b'test \\u0259'