带有 unicode 转义序列的文本在 python 中进行 unicode [英] text with unicode escape sequences to unicode in python

查看:35
本文介绍了带有 unicode 转义序列的文本在 python 中进行 unicode的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

可能的重复:
python中像\\uXXXX这样的字符串的转换

假设我有字符串

test
'\\u0259'

注意转义的反斜杠.

如何将其转换为相应的 unicode 字符串?

How do I convert it to the respective unicode string?

推荐答案

>>> print('test \\u0259'.decode('unicode-escape'))
test ə

这篇关于带有 unicode 转义序列的文本在 python 中进行 unicode的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆