>>> str = "世界你好!"
>>> b = str.encode('utf-8')
>>> type(b)
<class 'bytes'>
>>> b
b'\xe4\xb8\x96\xe7\x95\x8c\xe4\xbd\xa0\xe5\xa5\xbd!'
>>> b.decode('utf-8')
'世界你好!'
>>> str = "世界你好!"
>>> b = str.encode('utf-8')
>>> type(b)
<class 'bytes'>
>>> b
b'\xe4\xb8\x96\xe7\x95\x8c\xe4\xbd\xa0\xe5\xa5\xbd!'
>>> b.decode('utf-8')
'世界你好!'