[英]How to decode javascript unicode string in python?
I found that it is a character of TWO HEARTS
here . 我发现这是一个性格
TWO HEARTS
这里 。 I tried to decode it: 我试图对其进行解码:
a = '\ud83d\udc95'
a.encode('utf-8').decode('utf-8')
UnicodeEncodeError: 'utf-8' codec can't encode characters in position 0-1: surrogates not allowed
How to get the right symbol? 如何获得正确的符号?
Thank you. 谢谢。
The page you link to tells you the 您链接到的页面告诉您
Python Escape u'\\U0001f495'
Python换码u'\\ U0001f495'
Use it: 用它:
>>> u'\U0001f495'
'💕'
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.