An ode to re.finditer()
Robert Oschler
no_replies at fake_email_address.invalid
Sat Jul 31 19:57:50 EDT 2004
I figured I'd utter some words of praise for re.finditer(). It's such a
great feeling, when you come across a single statement that does everything
you want in two lines of code:
for g in re.finditer(pattern, string):
do_something_to_g(g)
In two lines of code I can break out all the sub-strings I need with a
regular expressions pattern, and have each of them operated upon by a
function.
Nice.
[Note: Python 2.2.3 or better is needed to use re.finditer()]
--
Robert
More information about the Python-list
mailing list