Multi-line comments for Python

Source: Internet
Author: User

Multiple lines of comments in Python with double and single quotes

At the same time Python receives single quotation marks ('), double quotation marks ("), three quotation marks (" ' "" ") to denote a string, the beginning and end of the quotation mark must be the same type of

Where three quotation marks can be composed of multiple lines, writing the shortcut syntax of multiple lines of text, common language file strings, at a specific location of the file, as a comment.

In the Python 2.6.6 environment

"""
Item_one = 1
Item_two = 2
Item_three = 3
Total = Item_one + \
Item_two + \
Item_three
Print Total
Word = ' word '
Sentence = "Lskdjn"
Paragraph = "' Kjhkjnda
Shdkjfakj
SDNF ' #这里用三个单引号来进行多行赋值, a syntax error is reported if you change to three double quotes. It is estimated that the runtime will recognize the ' paragraph= ' assignment statement, resulting in ambiguity collisions between the three double quotes in the assignment and the previous three double quotes. Why did not understand the specific, follow-up learning side to see.
Print paragraph
Raw_input ("\n\npress the Enter key to exit.")
"""

Multi-line comments for Python

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.