python字符串str和字节数组相互转化方法,pythonstr
python字符串str和字节数组相互转化方法,pythonstr
实例如下:
# 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和字节数组相互转化方法就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持帮客之家。
相关内容
- 解决Python requests 报错方法集锦,pythonrequests
- Python 专题二 条件语句和循环语句的基础知识,python基
- 关于python的bottle框架跨域请求报错问题的处理方法,
- Python 专题三 字符串的基础知识,python基础知识
- Unicode和Python的中文处理,
- 使用python实现生成用户信息,python生成用户信息
- Python闭包的两个注意事项(推荐),python注意事项
- python 与GO中操作slice,list的方式实例代码,pythonslice
- Python 专题四 文件基础知识,
- Python 专题五 列表基础知识(二维list排序、获取下标和
评论关闭