The difference between single quotes, double quotes, and three double quotes in Python

Source: Internet
Author: User

1. There is no difference between single and double quotation marks. Can be used just for convenience, reduce write too many escape characters.

Like what:

str='let\ ' s go! ' str="let' s go! "

Two kinds of equivalence, but the second is obviously more elegant.

2. Three double quotation marks are used to enter multiple lines of text, that is, the content entered between the three quotation marks will be preserved, the number and double quotation marks are not escaped, in which the invisible characters such as \ n and \ t will be preserved, the advantage is that you can replace some of the multiple lines of text.

The difference between single quotes, double quotes, and three double quotes in Python

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.