提示:扫一扫查出行【扫一扫了解最新限行尾号】复制提示 b = b"example" # bytes object
s = "example" # str object
sb = bytes(s, encoding = "utf8") # str to bytes
或者:sb = str.encode(s) # str to bytes
bs = str(b, encoding = "utf8") # bytes to str
或者:bs = bytes.decode(b) # bytes to str