Python中decode函数怎么用
在Python中使用decode函数的方法
decode:decode()函数的作用是指定的编码格式解码字符串。
decode()函数语法:
str.decode(encoding='UTF-8',errors='strict')
参数:
encoding:表示需要指定的编码。
errors:设置不同错误的处理方案。
decode()函数使用方法:
str = "hello world";
str = str.encode('base64','strict');
print "Encoded String: " + str;
print "Decoded String: " + str.decode('base64','strict')
输出结果为:
Encoded String: dGhpcyBpcyBzdHJpbmcgZXhhbXBsZS4uLi53b3chISE=
Decoded String: hello world
版权声明
本文仅代表作者观点,不代表米安网络立场。
上一篇:大数据应采用什么加密方式 下一篇:常用的java反编译工具有哪些
发表评论:
◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。