On Sun, Jul 6, 2008 at 5:09 AM, Lie Ryan <[EMAIL PROTECTED]> wrote:

> The string implicit string concatenation exist for things like verbose
> re (regular expression):
>
> import re
> re.compile(
> '<'     # Start opening tag
> '\s*'   # Arbitrary whitespace
> '(.*?)' # tagname
> '\s*'   # Arbitrary whitespace
> '(.*?)' # Values
> '>',    # Start closing tag
> re.VERBOSE
> )

VERBOSE regular expressions can contain comments; this could be written as
re.compile('''
<     # Start opening tag
\s*   # Arbitrary whitespace
(.*?) # tagname
\s*   # Arbitrary whitespace
(.*?) # Values
>''',    # Start closing tag
re.VERBOSE
)

Kent
_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to