Python comments and Chinese garbled characters

Source: Internet
Author: User

Python annotations are divided into three types:

1. Single-line Comment: #

2. Multiline Comment: 3 single quotes before and after, or three double quotes;

such as: ' Multiline comment ', ' "' or multiline comment '" "

3. Special NOTES:

As under Linux, at the top of the file and #!/usr/bin/python, the representative of the implementation of this file, the need to use this program to run;

python2* version does not support the problem of Chinese, the default file is ASCII, 3.* has been supported, you need to include in front of the file: #encoding = utf-8 or #coding = utf-8 or python formal notation # _*_coding:uft-8_* _

Garbled problem:

When the computer is stored, it is stored in 0, the minimum storage unit is a byte, the minimum storage unit is a bit (bit), a byte has 8 bit, when the computer is stored and read, must have a set of norms to standardize them ,

For example: I am Man, these English are to be converted into numbers to store, and also need to specify a few bytes to store , which formed a set of specifications, now the mainstream is the Unicode encoding, utf-8,utf-16,utf-32, these are all belong to the Unicode Coding

As long as the character to the number of different, or the storage of different bytes, there is a difference, will produce garbled, ASCII code is not supported in Chinese, and can only store 255 characters

Python comments and Chinese garbled characters

Related Article

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.