long lines, long string

Richard Chamberlain richard_chamberlainNOriSPAM at ntlworld.com.invalid
Wed Jun 28 09:32:51 EDT 2000


Hi Holger,

You can extend python code over lines in a few ways. Firstly
with a \ or with one half of a ( or { or [ and the other half
when you complete it.

You can extend strings over lines with triple speech marks

i.e.

spam=1
eggs=1
moreSpam=1
if spam and \
   eggs and \
   moreSpam:
    print 'chicken'

aBigTuple=('Hello','Holger',
          1,2,3,
          5,6,7)
aBigString="""A String can
stretch lots of lines
if you put triple speech marks
"""

print aBigTuple
print aBigString

Got questions?  Get answers over the phone at Keen.com.
Up to 100 minutes free!
http://www.keen.com




More information about the Python-list mailing list