码迷,mamicode.com
首页 > 其他好文 > 详细

bytes文件类型

时间:2018-10-18 01:01:14      阅读:541      评论:0      收藏:0      [点我收藏+]

标签:code   类型   编码   odi   utf-8   字符串   我爱你   string   enc   

msg = "我爱你"
print(msg.encode(encoding=‘utf-8‘)) #转成bytes类型文件 编码
print(msg.encode(encoding="utf-8").decode(encoding="utf-8")) #转回str字符串类型 先编码-->解码

string --> bytes encode编码

bytes --> string decode解码

bytes文件类型

标签:code   类型   编码   odi   utf-8   字符串   我爱你   string   enc   

原文地址:http://blog.51cto.com/13707996/2301454

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!