如何将 unicode 转换为 Python 字符串中的重音字符

亚伦

我有一份足球运动员的名字列表,但无法正确打印带有重音字符的名字。我查看了许多 StackOverflow 帖子,但似乎找不到有效的解决方案。

现在,Alexis S\u00e1nchez当我想要Alexis Sánchez.

匿名懦夫

对于 Python 3.x:

>>> print(bytes('Alexis S\\u00e1nchez', 'ascii').decode('unicode-escape'))
Alexis Sánchez

和 Python 2.x:

>>> print("Alexis S\\u00e1nchez".decode("unicode-escape"))
Alexis Sánchez

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章

将unicode字符串字典转换为python中的字典

将unicode字符串字典转换为python中的字典

Python字符串转换为unicode

将Unicode字符串转换为Python中的字符串(包含多余的符号)

如何将Unicode编码的字符串转换为字母字符串

如何将字符串中的特殊字符转换为unicode?

在Perl中,如何将字节数组转换为Unicode字符串?

如何使用python将其中包含unicode的字符串转换为unicode

将字符串转换为unicode

如何在Python3中将字符串转换为unicode?

Python将Python字符串转换为Numpy unicode字符串

在Python3中将unicode序列转换为字符串,但允许字符串中的路径

将java字符串中的unicode转换为unicode的字符串表示形式

如何在python2中将str类型的unicode字符串转换为真正的unicode字符串?

Python3-将Unicode文字字符串转换为Unicode字符串

如何将字符串转换为Unicode字符

如何在Python 2.7中将字符串中具有十六进制字符的字符串转换为完整的unicode

如何在python 2.7中将unicode字符串转换为字符串文字?

如何在python中从unicode代码点转换为实际的unicode字符串?

python将unicode转换为可读字符

将Unicode转换为Python 2中的字符串

Python:将unicode变量转换为字符串变量

如何使用Pandas Python将Unicode字符串转换为列表?

python3:如何将具有Unicode编码的字符串转换为字母字符串

将十六进制字符字符串转换为 Unicode 字符串(python)

如何将 unicode 转换为可读字符串?

如何将 unicode 字符串转换为 JSON?

如何将包含Unicode的json文件转换为字符串并在python中另存为json文件?

如何将字符串中的 UNICODE 字符转换为它们的字符串表示形式?