Python string symbol: Double quote/single quotation mark usage annotations.

Source: Internet
Author: User

It is well known that single and double quotes in Python are often used by us, such as print, input, and so on.

But most of the strings that are directed to the printout are in double quotes, "hello,python! ", and single quotes more (three single quotes) are used to annotate the code.

Once we encounter a string containing multiple single quotes and double quotes, the system will automatically determine the quotation marks node, thus breaking in the middle, this time it is necessary to use three single quotation marks to the whole paragraph of the code, if you need a variable assignment,

You only need to set a variable assignment plus what you need, but you can print multiple lines directly with three single quotes before and after the content!

Why do you add variables? Because it's a rule! You think about it. If the variable setting is included directly, then the annotation is used, so be sure to add a variable to use OH.

This use effect:

1. Print multiple lines

2, processing encountered ("content" "content" content "content" contents "content") multiple single-and double-mixed complex situation for direct printing processing. Very convenient Oh!

Python string symbol: Double quote/single quotation mark usage annotations.

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.