# bytes对象
b = b"example"

# string对象
s = "example"

# string转bytes
bytes(s, encoding = "utf8")
 
# bytes转string
str(b, encoding = "utf-8")
 
# 另一种方法
# string转bytes
str.encode(s)
 
# bytes转string
bytes.decode(b)