Re: split long string in two code lines

2011-06-13 Thread Terry Reedy
On 6/13/2011 5:51 PM, darnold wrote: print "this" \ " is" \ " a" \ " test" \ this is a test >>> print('this' ' is' ' a' ' test') this is a test Python ignores \n within parentheses, brackets, and braces, so no fragile trailing backslash needed. ('Fragile', bec

Re: split long string in two code lines

2011-06-13 Thread Chris Angelico
On Tue, Jun 14, 2011 at 9:03 AM, Tim Chase wrote: > On 06/13/2011 05:38 PM, Chris Angelico wrote: >> I'm not seeing the difference between these two. Pointer, please? >> *puzzled* > > Sorry...tried to make that clear in the surrounding text.  The first one has > the open-paren on the same line as

Re: split long string in two code lines

2011-06-13 Thread Tim Chase
On 06/13/2011 05:38 PM, Chris Angelico wrote: On Tue, Jun 14, 2011 at 8:33 AM, Tim Chase wrote: print ("this is not " "such a huge line " "even though it has " "lots of text in it." ) print ( "this is not " "such a huge line " "even though it has " "lots of

Re: split long string in two code lines

2011-06-13 Thread Chris Angelico
On Tue, Jun 14, 2011 at 8:33 AM, Tim Chase wrote: >  print ("this is not " >    "such a huge line " >    "even though it has " >    "lots of text in it." >    ) > >  print ( >    "this is not " >    "such a huge line " >    "even though it has " >    "lots of text in it." >    ) I'm not seeing th

Re: split long string in two code lines

2011-06-13 Thread Tim Chase
On 06/13/2011 04:55 PM, Tycho Andersen wrote: On Mon, Jun 13, 2011 at 11:31:29PM +0200, Tracubik wrote: 4print "this is a very long string that i'm going to write 5 here, it'll be for sure longer than 80 columns" Is there a better way to split the string? There is! Python (as C) c

Re: split long string in two code lines

2011-06-13 Thread Redcat
On Mon, 13 Jun 2011 23:31:29 +0200, Tracubik wrote: > 1 def foo(): > 2for index in ... > 3for plsdoit in ... > 4print "this is a very long string that i'm going to/ 5 > write here, it'll be for sure longer than 80 columns" If you're going to use the \ anyway, how about: >

Re: split long string in two code lines

2011-06-13 Thread Tycho Andersen
On Mon, Jun 13, 2011 at 11:31:29PM +0200, Tracubik wrote: > Hi all, > > newbie question here > > how can i write code like this: > > 1 def foo(): > 2for index in ... > 3for plsdoit in ... > 4print "this is a very long string that i'm going to > write 5 here, it'll be for

Re: split long string in two code lines

2011-06-13 Thread darnold
print "this" \ " is" \ " a" \ " test" \ >>> RESTART >>> this is a test -- http://mail.python.org/mailman/listinfo/python-list