Python base64 encoding and decoding instance

Source: Internet
Author: User

Python base64 encoding and decoding instance

This article mainly introduces Python base64 encoding and decoding instances. This article provides the instance Code directly, which is also very easy to use. If you need it, refer

The Base64 module is used for base64 encoding and decoding in Python. Sample Code:

?

1

2

3

4

5

6

7

#-*-Coding: UTF-8 -*-

Import base64

 

Str = 'cnblogs'

Str64 = base64.b64encode (str)

Print str64 # Y25ibG9ncw =

Print base64.b64decode (str64) # cnblogs

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.