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.
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to