Multiline strings and indentation
j vickroy
jvickroy at sec.noaa.gov
Mon Jul 17 16:37:06 EDT 2000
How about:
>>> print "this" + \
" is" + \
" a" + \
" long" + \
" string"
this is a long string
>>>
"donotspam-jen at personic.com" wrote:
> 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