Python输出显示的问题
2019-07-12 本文已影响0人
锋锋锋锋丶
解决python中包含UTF-8编码中文的列表或字典的输出
import json
print json.dumps(dict, encoding="UTF-8", ensure_ascii=False)
# 如果是字符串,直接输出或者
print str.encode("UTF-8")
解决python中输出包含���的问题
print(i.decode('gbk'))
import json
print json.dumps(dict, encoding="UTF-8", ensure_ascii=False)
# 如果是字符串,直接输出或者
print str.encode("UTF-8")
print(i.decode('gbk'))