inkhorn <matt.dub...@sympatico.ca> writes:
> def list_items_in_string(list_items, string):
>     for item in list_items:
>         if item in string:
>             return True
>     return False

You could write that as (untested):

  def list_items_in_string(list_items, string):
     return any(item in string for item in list_items)

but there are faster algorithms you could use if the list is large and
you want to do the test on lots of long strings, etc.
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to