split encloser

Alex Martelli aleax at aleax.it
Sun Apr 13 18:52:19 CEST 2003


Chris wrote:
   ...
> Thanks Inyeol. Be nice if they gave a small example of using finditer.

How small?  E.g., here's how you could rewrite (a simpler version of)
findall using finditer (warning, untested):

def findall(are, instring):
    return [mo.group(0) for mo in are.finditer(instring)]

Too small?  Then perhaps you could mention a larger one...?


Alex






More information about the Python-list mailing list