打开APP
userphoto
未登录

开通VIP,畅享免费电子书等14项超值服

开通VIP
python str与byte转换 encode decode
https://blog.csdn.net/A13155283231/article/details/80148550

具体内容可以查python3.6文档

# str to bytekey = "aaa"r = str.encode(key)print(type(r))print(r)# byte to strkey2 = b"aaa"r = key2.decode()print(type(r))print(r)

输出:

<class 'bytes'>b'aaa'<class 'str'>aaa
本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请点击举报
打开APP,阅读全文并永久保存 查看更多类似文章
猜你喜欢
类似文章
【热】打开小程序,算一算2024你的财运
python3大作战之encode与decode讲解
专业在线电子书网站
python3 bytes.decode()与python3 str.encode()
python3中编码与解码之Unicode与bytes
字符串 与  字节流
成功解决TypeError: a bytes-like object is required, not ''str''
更多类似文章 >>
生活服务
热点新闻
分享 收藏 导长图 关注 下载文章
绑定账号成功
后续可登录账号畅享VIP特权!
如果VIP功能使用有故障,
可点击这里联系客服!

联系客服