0
点赞
收藏
分享

微信扫一扫

Python去掉Unicode编码中的‘\u‘开头

小编 2022-05-30 阅读 67

Unicode编码的字符串,print()显示为'\u....'开头,在Python中无法通过直接删除'\u'来获取后边的字符串,通过如下方法可以

'\ue567'.encode('raw_unicode_escape').decode('utf-8').replace('\\u', '')
得到'e567'字符串。

搜索

复制


举报

相关推荐

0 条评论