编码与解码

decode:将其他编码的字符串转换成unicode编码,如str1.decode('utf-8'),表示将utf-8的编码转换成unicode编码。

encode:将unicode编码转换成其他编码的字符串,str2.encode('utf-8'),表示将unicode编码的字符串转换成utf-8编码。

decode是解码,encode是编码

原文地址:https://www.cnblogs.com/leoych/p/11840771.html