python从入门到精通-字符串
在python中,有两种常用的字符串类型,分别为str和bytes(二进制数据)。
1.使用encode()方法编码-将字符串转换为二进制数据
str.encode([encoding=“utf-8”],[,errors=“strict”])
2.使用decode()方法解码–将二进制数据转化为字符串
bytes.decode([encoding=“utf-8”],[errors=“strict”])
``
>>> verse="野渡无人舟自横"
>>> byte=ver
原创
2020-08-02 21:01:14 ·
125 阅读 ·
0 评论