unicode的编码转换成中文的list

来源:互联网 发布:阿里云微服务 编辑:程序博客网 时间:2024/06/05 18:15
#unicode的编码转换成中文的listdef testUnicodeToChineseList(all_symptom):    str_symptom = str(all_symptom).replace('u\'', '\'')    return str_symptom.decode("unicode-escape")

打印集合查看元素,调用函数。

print s.keywords(3)print testUnicodeToChineseList(s.keywords(3))

查看打印结果比较一下

[u'\u8bed\u8a00',  u'\u81ea\u7136',  u'\u8ba1\u7b97\u673a']
['语言', '自然', '计算机']