python的encode()和decode()函数

时间:2020-07-05 00:52:12   收藏:0   阅读:72

decode()函数的作用是用作解码,encode()函数是用作编码。

decode函数以encoding指定的编码格式解码字符串,默认是字符串编码。
语法是:
str.decode(encoding=‘utf-8‘)

encode函数以encoding指定的编码格式编码字符串。
语法是:
str.encode(encoding)
encoding指定要使用的编码。

评论(0
© 2014 mamicode.com 版权所有 京ICP备13008772号-2  联系我们:gaon5@hotmail.com
迷上了代码!