Python coding knowledge learning notes, python learning notes

Source: Internet
Author: User

Python coding knowledge learning notes, python learning notes

Python coding knowledge learning notes

>>> A = 'medium' ===> a is an encoded binary. It adopts the default encoding method of the operating system, similar to byte.

>>> S = U' '===> s is a unicode type, 32-bit integer, and the variable content is a unicode code word (codepoint)

>>>

'\ Xd6 \ xd0' ==> as described above, the current system is GBK encoding, And the binary value of GBK Encoding

>>> S

U' \ u4e2d '==> as mentioned above, the 4e2d code is stored, consistent with the unicode definition.

>>> Print

Medium

>>> Print s

Medium

>>> A. decode ('gbk'). encode ('utf-8') ==> After decoding a string, encode it using utf8.

'\ Xe4 \ xb8 \ xad'

>>> S. encode ('utf-8') ==> encode the code 4e2d using the utf8 encoding scheme, and output the encoded binary value and

'\ Xe4 \ xb8 \ xad' ==> the content in step 1 is consistent.

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.