python3.5.2中文字符乱码问题解决

>>> str = "世界你好!"
>>> b = str.encode('utf-8')
>>> type(b)
<class 'bytes'>
>>> b
b'xe4xb8x96xe7x95x8cxe4xbdxa0xe5xa5xbd!'
>>> b.decode('utf-8')
'世界你好!'

  



原文地址:https://www.cnblogs.com/luoye00/p/7099663.html