UnicodeEncodeError: ‘ascii’ codec can’t encode characters in position 53-56: ordinal not in range(128)
解决方法:xml库,添加如下
vi /usr/lib/python2.7/xml/etree/ElementTree.py
import sys
reload(sys)
sys.setdefaultencoding( “utf-8” )
dump json文件:
json.dumps(data, ensure_ascii=False, sort_keys=True, indent=4, separators=(‘,’, ‘: ‘)).replace(“\n”,”n”)