下面小编就为大家带来一篇python将unicode转为str的方法。小编觉得挺不错的。现在就分享给大家,也给大家做个参考。一起跟随小编过来看看吧
问题:
将u’\u810f\u4e71’转换为’\u810f\u4e71′
方法:
s_unicode = u'\u810f\u4e71' s_str = s_unicode.encode('unicode-escape').decode('string_escape')
以来源gao($daima.com搞@代@#码(网上就是python将unicode转为str的方法的详细内容,更多请关注gaodaima搞代码网其它相关文章!