定义列表并直接输出,结果输出结果中文是乱码:
e=['你好',1,'apple'] printe
输出结果:
['\xe4\xbd\xa0\xe5\xa5\xbd', 1, 'apple']
解决方法:
e=['你好',1,'apple'] printjson.dumps(e,encoding='utf-8',ensure_ascii=False)
输出结果:
原文来自:https://www.py.cn["你好", 1, "apple"]
© 版权声明
文章版权归作者所有,未经允许请勿转载。
THE END
暂无评论内容