469,579 Members | 1,218 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,579 developers. It's quick & easy.

An ode to re.finditer()

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
Jul 18 '05 #1
0 1270

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Tim Arnold | last post: by
4 posts views Thread by Erik Johnson | last post: by
6 posts views Thread by Erick | last post: by
26 posts views Thread by John Salerno | last post: by
14 posts views Thread by micklee74 | last post: by
6 posts views Thread by George Sakkis | last post: by
3 posts views Thread by Gilles Ganault | last post: by
4 posts views Thread by gardsted | last post: by
reply views Thread by suresh191 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.