re.finditer
Michele Simionato
mis6 at pitt.edu
Tue Jul 23 11:06:18 EDT 2002
According to the standard library
http://www.python.org/doc/current/lib/node99.html :
finditer(pattern, string)
Return an iterator over all non-overlapping matches for the RE
pattern
in string. For each match, the iterator returns a match object.
Empty
matches are included in the result. New in version 2.2.
However:
$ python
Python 2.2.1 (#1, Apr 9 2002, 13:10:27)
[GCC 2.96 20000731 (Red Hat Linux 7.1 2.96-98)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import re
>>> re.finditer('r+?','library')
Traceback (most recent call last):
File "<stdin>", line 1, in ?
AttributeError: 'module' object has no attribute 'finditer'
The command re.finditer is not recognized ! All the other commands
work,
for instance
>>> re.findall('r+?','library')
['r', 'r']
find all the occurences of the letter 'r' in the word library as I
want.
I can live without finditer; however I would like to know if others
have
experienced the same problem. I installed the standard RPM packages
from http://www.python.org/2.2.1/rpms.html
--
Michele Simionato - Dept. of Physics and Astronomy
210 Allen Hall Pittsburgh PA 15260 U.S.A.
Phone: 001-412-624-9041 Fax: 001-412-624-9163
Home-page: http://www.phyast.pitt.edu/~micheles/
P.S. I discovered later that the same problem is in the Windows
version too.
More information about the Python-list
mailing list