long string constants

Duncan Booth duncan at NOSPAMrcp.co.uk
Tue Nov 13 04:30:46 EST 2001


Oliver Fromme <olli at secnetix.de> wrote in news:9sp0ps$c23$2 at isp-m-
srv06.izb.net:

>>>> s = "%s " \
> ...     "%s " \
> ...     "%s " % \
> ...     ("foo",
> ...      "bar",
> ...      "baz")
>>>> s
> 'foo bar baz '
> 
> Note that you don't have to use explicit backslashes within
> the parentheses of the tuple (they wouldn't hurt, though).

If you stick another set of parentheses round the whole lot then you don't 
need backslashes for the string concatenation either.

-- 
Duncan Booth                                             duncan at rcp.co.uk
int month(char *p){return(124864/((p[0]+p[1]-p[2]&0x1f)+1)%12)["\5\x8\3"
"\6\7\xb\1\x9\xa\2\0\4"];} // Who said my code was obscure?



More information about the Python-list mailing list