时间:2021-07-01 10:21:17 帮助过:158人阅读
实例如下:
# bytes object b = b"example" # str object s = "example" # str to bytes bytes(s, encoding = "utf8") # bytes to str str(b, encoding = "utf-8") # an alternative method # str to bytes str.encode(s) # bytes to str bytes.decode(b)
以上就是python字符串str和字节数组相互转化方法详细介绍的详细内容,更多请关注Gxl网其它相关文章!