Multiline strings and indentation

donotspam-jen@personic.com dnotspam-jen at personic.com
Mon Jul 17 15:58:46 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