36 Examples of getting started with Python-04 elegant strings

Source: Internet
Author: User

#004 <br/> # use three quotation marks (''' or """) multiple-line string <br/> Print ''' line1 <br/> line2 <br/> line3 ''' <br/> # In addition, you can also use single and double quotation marks in any three quotation marks <br/> Print ''' "what's up? , "He replied. ''' <br/> # Otherwise, you can use escape characters to achieve the same effect. <br/> # It is better to use three quotation marks, otherwise, the visual beauty will be damaged. <br/> Print '/"What/'s up? ,/"He replied. '<br/> # You can use raw (R) (original string) to eliminate the escape Function of escape characters <br/> Print R'/"What/'s up? ,/"He replied. '<br/> # The full equality between single quotes and double quotes seems to mean that python does not have the concept of" char "<br/> # this is exactly the case! <Br/> # "char" is a machine service (the genesis of the computer revolution was in a machine. the genesis of our programming ages thus tends to look like that machine .) <br/> # Python serves programmers.

 

Output:

1
2
3
4
5
6
Line1
Line2
Line3
"What's up? , "He replied.
"What's up? , "He replied.
/"What/'s up? ,/"He replied.

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.