re.search over a list
Bruno Desthuilliers
bruno.42.desthuilliers at websiteburo.invalid
Thu Oct 23 12:28:27 EDT 2008
More information about the Python-list mailing list
Thu Oct 23 12:28:27 EDT 2008
- Previous message (by thread): re.search over a list
- Next message (by thread): re.search over a list
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Steve Holden a écrit : > Pat wrote: >> Bruno Desthuilliers wrote: (snip) >>> words = ['foo', 'bar', 'somestring', 'baaz'] >>> re.search(r"^somestring$", "\n".join(words), re.MULTILINE) (snip) >> > I suspect that > > any(re.match(pat, word) for word in words) > > might be a more efficient way to do this. Indeed. I'm not yet used to have all and any builtins, thanks for the reminder.
- Previous message (by thread): re.search over a list
- Next message (by thread): re.search over a list
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list