Jeff <[EMAIL PROTECTED]> wrote: > def foo(sample, strings): > for s in strings: > if sample in s: > return True > return False > > This was an order of magnitude faster for me than using str.find or > str.index. That was finding rare words in the entire word-list (w/ > duplicates) of War and Peace.
However it's the wrong way around, in my case 'sample' is the longer string and I want to know if s is in it. It's simple enough to do it the other way around though:- def foo(sample, strings): for s in strings: if s in sample: return True return False Using in rather than find() and making it a function would seem to be the way to go, thanks. -- Chris Green -- http://mail.python.org/mailman/listinfo/python-list