网络编程
位置:首页>> 网络编程>> Python编程>> python将unicode转为str的方法

python将unicode转为str的方法

作者:jingxian  发布时间:2022-04-30 23:15:18 

标签:python,unicode,str

问题: 

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

方法: 


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

猜你喜欢

手机版 网络编程 asp之家 www.aspxhome.com