Python File Header encoding statement

Source: Internet
Author: User
You can see this writing: #-*-coding: UTF-8-*-this is used to illustrate your Python source ProgramThe encoding used for the file. By default, your program needs to be written in ASCII code, but if you write Chinese in it, the python interpreter usually reports an error, but if you add the file encoding you use, python will automatically handle the error. However, I hate writing so long, because n declaration methods have to be recorded due to this encoding problem. For example, in HTML, in CSS files, how can this problem be solved,
The preceding format can also be written as follows:
# Coding = UTF-8
Or
# Coding: UTF-8

It's easy to remember, and the handwriting error rate is also reduced.

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.