python 2 的转码问题真是不好搞,一直用的python3 今天遇到这个问题甚是头疼啊:
解决方法:
用 json包
import json ll = {'to_station': '\xd6\xa3\xd6\xdd'} print json.dumps(ll, encoding="gb2312", ensure_ascii=False)
就简单的一句代码,搞得我头疼,惭愧啊!!!!!
python 2 的转码问题真是不好搞,一直用的python3 今天遇到这个问题甚是头疼啊:
解决方法:
用 json包
import json ll = {'to_station': '\xd6\xa3\xd6\xdd'} print json.dumps(ll, encoding="gb2312", ensure_ascii=False)
就简单的一句代码,搞得我头疼,惭愧啊!!!!!