semi-concatenated strings
Duncan Booth
duncan at NOSPAMrcp.co.uk
Fri May 31 04:07:16 EDT 2002
Chris Liechti <cliechti at gmx.net> wrote in
news:Xns921EEEC6D92A7cliechtigmxnet at 62.2.16.82:
> i think the example is in the docs. e.g. when you want to comment on a
> complicated string, like an regex:
>
> re.compile("([ab])+" #group one (at least one occurence of either a
> or b)
> "(hello)*" #group two (optional)
> )
In this case you could also put the comments inside a single string which
may or may not make it more readable:
r = re.compile('''
([ab])+ #group one (at least one occurence of either a or b)
(hello)* #group two (optional)''',
re.VERBOSE)
--
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