Python--long string

Source: Internet
Author: User

If you need to write a very very long string, it needs to span more than one line, then you can use three quotation marks instead of normal quotes.

Print " " This is a very long string. It continues here. And it ' s not over yet. " Hello, world! " Still here. " "

You can also use a single double quotation mark, such as "" Like this "". Note that because of this unusual way of referencing, you can use both single and double quotes in a string, without having to escape using backslashes.

########################## Split Line ########################

Ordinary expressions can also span rows, and if the last character in a row is a backslash, the line break itself is "escaped", which is ignored. For example:

Print " Hello, world!. "

This phrase will print Hello, world!, and this usage also applies to this expression and statement:

>>> 1 + 2 +                print               'Hello,world'Hello, World

Python--long string

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.