python输出字典中的中文

如果不用本文指定的方法,会有如下报错:

UnicodeDecodeError: 'utf8' codec can't decode byte 0xbf in position 2: invalid start byte

解决方法:

import json

print json.dumps(mail_detail_list,encoding='utf-8',ensure_ascii=False)

原文地址:https://www.cnblogs.com/robinunix/p/6929612.html