欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

Python3中编码问题

程序员文章站 2022-04-19 18:18:35
html = r'{"code":404,"msg":"\u8be5\u8d44\u6e90\u4e0d\u5b58\u5728"}' print(html)# {"code":404,"msg":"\u8be5\u8d44\u6e90\u4e0d\u5b58\u5728"} print(html. ......

html = r'{"code":404,"msg":"\u8be5\u8d44\u6e90\u4e0d\u5b58\u5728"}'

print(html)
# {"code":404,"msg":"\u8be5\u8d44\u6e90\u4e0d\u5b58\u5728"}

print(html.encode('utf-8').decode('unicode-escape'))
# {"code":404,"msg":"该资源不存在"}