re.compile question
Gordon McMillan
gmcm at hypernet.com
Tue Feb 29 12:31:05 EST 2000
Gregoire Welraeds writes:
>
> Yes it's me again ;)
> How can I test that a re.compile has failed, Eg: If i simply forget a (
> in my regular expression
>
> --
> Life is not fair
> But the root password helps
The interpreter does, too.
>>> import re
>>> x = re.compile("(")
Traceback (innermost last):
File "<stdin>", line 1, in ?
File "D:\Programs\Python\Lib\re.py", line 79, in compile
code=pcre_compile(pattern, flags, groupindex)
pcre.error: ('missing )', 1)
>>>
- Gordon
More information about the Python-list
mailing list