Multiline strings and indentation
richard_chamberlain
richard_chamberlain at ntlworld.com
Mon Jul 17 16:42:39 EDT 2000
Hi Jen,
How about:
def multiline(x):
if x:
print "this is a" \
"multi-line string that spans" \
"three lines" \
print "another string"
Richard
donotspam-jen at personic.com <dnotspam-jen at personic.com> wrote in message
news:39736250$0$14722 at wodc7nh6.news.uu.net...
> 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