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