google下,有些回答是在字符串前加u''或者unicode(str,'utf-8')方法转换,可是我现在因为使用的hmset和hgetall保存整个对象,取出也是整个对象,所以想问下有没有现成的方法可以进行转换的。取出如果是中文的话是这样的:
{'name': 'match', 'title': '\xe6\xaf\x94\xe8\xb5\x9b', 'section_title': '\xe6\xb4\xbb\xe5\x8a\xa8', '_id': '4fb1c6329b10ed1adc000000', 'id': '1'}
是英文的话就直接显示了英文
报错还是老样子:
'ascii' codec can't decode byte 0xe6 in position 12,
{'name': 'match', 'title': '\xe6\xaf\x94\xe8\xb5\x9b', 'section_title': '\xe6\xb4\xbb\xe5\x8a\xa8', '_id': '4fb1c6329b10ed1adc000000', 'id': '1'}
是英文的话就直接显示了英文
报错还是老样子:
'ascii' codec can't decode byte 0xe6 in position 12,
