John <[EMAIL PROTECTED]> wrote: > Thanks a lot, > > This works but is a bit slow, I guess I'll have to live with it. > Any chance this could be sped up in python?
Sure (untested code): def count_with_overlaps(needle, haystack): count = 0 pos = 0 while True: where = haystack.index(needle, pos) if where == -1: return count count += 1 pos = where + 1 Alex -- http://mail.python.org/mailman/listinfo/python-list