[Tutor] Pythonic way to extract delimited substrings

Alan Gauld alan.gauld at btinternet.com
Mon Apr 14 21:01:46 CEST 2008


"Malcolm Greene" <python at bdurham.com> wrote in

> Background: I have a long multi-line string with expressions 
> delimited
> with '<(' and ')>' markers. I would like to extract these substrings 
> and
> process them in a loop.
>
> I know how to do this task with regular expressions, but I'm always
> cautious about using a bazooka when a hammer will suffice.

Sounds like an ideal candidate for regex and findall to me.

If you have to stop a tank a bazooka may be the right tool...

Alan G. 




More information about the Tutor mailing list