Posted By

magicrebirth on 09/16/10


Tagged

String formatting literal


Versions (?)

String literals that span multiple lines


 / Published in: Python
 

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

  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

Report this snippet  

You need to login to post a comment.