Pyhton of single line, multiline annotation notation and its specification

Source: Internet
Author: User
One, single-line comment symbol

# used as a single-line comment symbol.
Print 1 #输出1

Two, multi-line comment symbol

Multiline comments are enclosed in three quotation marks "".

‘‘‘
Used to parse all pages saved from a Web page (HTML)

Used to parse all pages saved from a Web page (HTML)
‘‘‘

Three, Chinese annotation method

When writing code in Python, you will not be able to avoid appearing or using Chinese, and you will need to add Chinese comments at the beginning of the file. If the beginning does not declare the format of the saved encoding, then it will default to use the Askii code to save the file, if you have Chinese in your code will be wrong, even if your Chinese is included in the comment. So it's important to add Chinese notes. Must be placed on the first line
#-*-Coding=utf-8-*-

Pyhton of single line, multiline annotation notation and its specification

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.