# 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网其它相关文章!
查看更多关于python字符串str和字节数组相互转化方法详细介绍的详细内容...
声明:本文来自网络,不代表【好得很程序员自学网】立场,转载请注明出处:http://www.haodehen.cn/did85488