Python encoding (encode) decoding (decode) problem

Source: Internet
Author: User

Hurried
Print (s)
S1 = S.decode (# Utf-8 to Unicode,decode (decoding) need to indicate the current encoding format
Print (S1,type (S1))

S2 = S1.encode (# Unicode to Gbk,encode (encoded) need to indicate the generated encoding format
Print (S2,type (s2))

S3 = S1.encode (# Unicode to Utf-8,encode (encoded) note generated encoding format
Print (S3,type (S3))

# Unicode encoding

S1 = S.encode (# converts Unicode encoding to Utf-8

S2 = S.decode (# converts Unicode decoding to Utf-8

Print S1
Print S2

Python encoding (encode) decoding (decode) problem

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.