[Python] bytes 转换成 str
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
posted on 2019-07-29 10:44 liujx2019 阅读(2875) 评论(0) 编辑 收藏 举报