python解码和转码:byte类型

#decoding转为字符串:解码;encode转为二进制:转码
msg = "我爱北京天安门"
print(msg.encode()) #encode默认utf-8
print(msg.encode(encoding="utf-8").decode(encoding="utf-8"))
posted @ 2018-04-25 09:24  无所住心  阅读(1562)  评论(0编辑  收藏  举报