伴随着梦想前行
29/11
2018

python2编码转换将unicode转换为str

def tostr(text):
    if isinstance(text, unicode):
        text = text.encode("unicode_escape").decode("string_escape")
    return text

添加新评论