Multiline strings and indentation

dnotspam-jen at personic.com.bbs dnotspam-jen at personic.com.bbs
Mon Jul 17 15:50:04 EDT 2000


I'm just getting started with Python. The indentation feature really does
make things readable ... except when using multi-line strings.  This just
doesn't look right:

def multiline(x):
  if x:
    print """this is a
multi-line string that spans
three lines"""
 print "another string"

Is there a way to make the above more readable? It would be nice if it could
be written this way and have Python just figure out what whitespace to
ignore:

def multiline(x):
  if x:
    print """this is a
             multi-line string that spans
             three lines"""
 print "another string"

Thanks for any suggestions!

Jen



More information about the Python-list mailing list