Be gentle with me....

Preston Landers prestonlanders at my-deja.com
Sun Dec 5 22:53:57 EST 1999


Interesting.  I had no idea that this was a valid construct:

>>> foo = "x" "y" "z"
>>> print foo
'xyz'

thanks for the informative post.  You're right about the ugly string,
mine was a bad example.

learning-something-new-every-dayly-yours,

---Preston

In article <82aj7d$2dl9$2 at hub.org>,
  xxx at NO-MAIL wrote:
> On Fri, 03 Dec 1999 16:19:04 GMT, Preston Landers wrote:
> >> want to continue a line of code over multiple physical lines?
> >
> >x = "This is a \
> >  line of code \
> >  spanning multiple \
> >  lines"
>
> Although the original poster asked about code spanning lines, and the
> above example, while in a string, demonstrates the concept, i want to
> point out that the above string will produce...
>
> "This is a   line of code    spanning multiple   lines"
>
> (For that ugly effect you might as well use multi-line quotes...
>
> x = """This is a
>   line of code
>   spanning multiple
>   lines"""
>
> )
>
> However, to demonstrate the concept of multi-line code AND keep the
> spacing nice in our string, this works best...
>
> x = "This is a " \
>   "line of code " \
>   "spanning multiple " \
>   "lines"
>
>

--
|| Preston Landers <prestonlanders at my-deja.com> ||


Sent via Deja.com http://www.deja.com/
Before you buy.




More information about the Python-list mailing list