python2问题收集

1、python2 打印中文乱码解决办法

  python2打印列表,字典里面含有中文时,会乱码

a= {"id": 1, "title": "标题1".decode('utf-8')}
print json.dumps(a, encoding='UTF-8', ensure_ascii=False)

  python2写入文件含有中文,不受影响

原文地址:https://www.cnblogs.com/snailon/p/12579972.html