python str与bytes之间的转换
# bytes objectb = b"example"
# str objects = "example"
# str to bytessb = bytes(s, encoding = "utf8")
# bytes to strbs = str(b, encoding = "utf8")
# an alternative method # str to bytessb2 = str.encode(s)
# bytes to strbs2 = bytes.decode(b)
转载请注明原文地址: https://lol.8miu.com/read-30192.html