long lines, long string

John W. Baxter jwbnews at scandaroon.com
Wed Jun 28 15:50:57 EDT 2000


In article <8jcudd$gdk$1 at slb7.atl.mindspring.net>, aahz at netcom.com 
(Aahz Maruch) wrote:

> In article <j9tcj8.i0b.ln at iiab.soluma.de>,
> Holger M. Füßler <fuessler at solutec.de> wrote:
> >
> >Is there a possibility to put long lines of python-source-code in 
> >multiple
> >lines (for better clarity)?
> 
> myDict = {
>   'foo': 1,
>   'bar': 2,
>   'baz': 3
>   }
> 
> if myDict[xyzzy] == 'foo' \
>   or myDict[xyzzy] == 'bar' \
>   or myDict[xyzzy] == 'baz' :
> 
> >How can I accomplish the same with strings?
> 
> """
> This
> is 
> a 
> long
> string
> """

And, if you don't want the resulting returns, look into concatenation of 
"adjacent" strings:

>>> a = "this "\
... "is "\
... "a "\
... "long "\
... "string. " 
>>> a
'this is a long string. '
>>> 

  --John

-- 
John W. Baxter   Port Ludlow, WA USA  jwbnews at scandaroon.com



More information about the Python-list mailing list