定义列表并直接输出,结果输出结果中文是乱码:
e=['你好',1,'apple'] print e
输出结果:
['\xe4\xbd\xa0\xe5\xa5\xbd', 1, 'apple']
解决方法:
e=['你好',1,'apple'] print json.dumps(e,encoding='utf-8',ensure_ascii=False)
输出结果:
["你好", 1, "apple"]
更多Python知识请关注
Copyright © 2019- huatuowenda.com 版权所有 湘ICP备2023022495号-1
违法及侵权请联系:TEL:199 1889 7713 E-MAIL:2724546146@qq.com
本站由北京市万商天勤律师事务所王兴未律师提供法律服务