
python字符串解码的方法:
python中可以使用decode()方法对字符串进行解码。
python中可以使用encode()方法将字符串转换为bytes类型,此过程称为“编码”。
decode() 方法用于将 bytes 类型的二进制数据转换为 str 类型,这个过程也称为“解码”。
decode() 方法的语法格式如下:
1 |
|
示例:
1 2 3 4 5 6 7 |
|
输出结果如下:
Encoded String: dGhpcyBpcyBzdHJpbmcgZXhhbXBsZS4uLi53b3chISE=
Decoded String: this is string example....wow!!!
更多Python知识请关注Python自学网。