承接国内外服务器租用托管、定制开发、网站代运营、网站seo优化托管接单、网站代更新,新老站点皆可!!咨询QQ:3787320601
当前位置:首页  >  互联网圈  >  Python中decode函数如何用

Python中decode函数如何用

管理员 2023-03-27 09:54:21 互联网圈 39 ℃ 0 评论 939字 收藏

Python中decode函数如何用

Python中decode函数怎么用

在Python中使用decode函数的方法

decode:decode()函数的作用是指定的编码格式解码字符串。

decode()函数语法:

str.decode(encoding='UTF⑻',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

文章来源:丸子建站

文章标题:Python中decode函数如何用

https://www.wanzijz.com/view/4634.html

相关文章

Related articles

X

截屏,微信识别二维码

微信号:weimawl

(点击微信号复制,添加好友)

打开微信