String literals that span multiple lines


/ Published in: Python
Save to your folder(s)



Copy this code and paste it in your HTML
  1. # Continuation lines can be used, with a backslash as the last character on the
  2. # line indicating that the next line is a logical continuation of the line:
  3.  
  4. hello = "This is a rather long string containing\n\
  5. several lines of text just as you would do in C.\n\
  6. Note that whitespace at the beginning of the line is\
  7. significant."
  8.  
  9. print hello

URL: http://www.java2s.com/Code/Python/String/Stringliteralsspanmultiplelinesinseveralways.htm

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.