1、tagCountDict是一个字典 key是中文,value是英文, print json.dumps(tagCountDict, ensure_ascii=False) 出错,错误信息如下:
‘ascii’ codec can’t encode characters in position 2-5: ordinal not in range(128)
原因:key和value编码不一致导致 key是utf-8,value是unicode编码
1、tagCountDict是一个字典 key是中文,value是英文, print json.dumps(tagCountDict, ensure_ascii=False) 出错,错误信息如下:
‘ascii’ codec can’t encode characters in position 2-5: ordinal not in range(128)
原因:key和value编码不一致导致 key是utf-8,value是unicode编码