(转)Python2.X如何将Unicode中文字符串转换成 string字符串2019-06-01

普通字符串能够用多种方式编码成Unicode字符串,具体要看你究竟选择了哪一种编码: unicodestring = u"Hello world"编码 将Unicode转化为普通Python字符串:"encode" utf8string = unicodestring.encode("utf-8") asciistring = unicodestring.encode("ascii") isost
相关文章
相关标签/搜索