Troubleshooting: re.finditer() creates object even when no match found

Nick Coghlan ncoghlan at iinet.net.au
Sat Dec 18 08:22:21 CET 2004


Chris Lasher wrote:
> Hello,
> I really like the finditer() method of the re module. I'm having
> difficulty at the moment, however, because finditer() still creates a
> callable-iterator oject, even when no match is found. This is
> undesirable in cases where I would like to circumvent execution of code
> meant to parse out data from my finditer() object.

Take a look at itertools.tee

Cheers,
Nick.

-- 
Nick Coghlan   |   ncoghlan at email.com   |   Brisbane, Australia
---------------------------------------------------------------
             http://boredomandlaziness.skystorm.net



More information about the Python-list mailing list