re.finditer

John Hunter jdhunter at nitace.bsd.uchicago.edu
Tue Jul 23 11:51:36 EDT 2002


>>>>> "Michele" == Michele Simionato <mis6 at pitt.edu> writes:

    Michele> According to the standard library
    Michele> http://www.python.org/doc/current/lib/node99.html :

    Michele> finditer(pattern, string) Return an iterator over all
    Michele> non-overlapping matches for the RE pattern in string. For
    Michele> each match, the iterator returns a match object.  Empty
    Michele> matches are included in the result. New in version 2.2.

You want 'import sre'

>>> import sre
>>> import re
>>> re.finditer('r+?','library')
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
AttributeError: 'module' object has no attribute 'finditer'
>>> sre.finditer('r+?','library')
<callable-iterator object at 0x4018dda0>

Is this a documentation bug?

JDH



More information about the Python-list mailing list