当前位置:主页 > 软件编程 > Python代码 >

python将unicode转为str的方法

时间:2021-09-11 08:09:46 | 栏目:Python代码 | 点击:

问题: 

将u'\u810f\u4e71'转换为'\u810f\u4e71'  

方法: 

s_unicode = u'\u810f\u4e71' 
s_str = s_unicode.encode('unicode-escape').decode('string_escape')  

您可能感兴趣的文章:

相关文章