Substring Detection? Pythonically?

Huaiyu Zhu hzhu at users.sourceforge.net
Wed Oct 4 16:44:44 EDT 2000


On Wed, 4 Oct 2000 21:56:45 +0200, Hakan Nilsson <hakan at netg.se> wrote:

>filter(lambda s: not string.find(s, 'th'), list)

Cool. 

BTW, why isn't there a string.match method, like re.match.  That would mean

filter('th'.match, list)

It would also be more efficient if the strings in list are long.

Huaiyu



More information about the Python-list mailing list