一聚教程网:一个值得你收藏的教程网站

最新下载

热门教程

python将unicode转为str的方法

时间:2017-06-22 编辑:简简单单 来源:一聚教程网

问题: 

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

方法: 

 

 代码如下复制代码

s_unicode=u'\u810f\u4e71'

s_str=s_unicode.encode('unicode-escape').decode('string_escape')

 

热门栏目