Tim Chase wrote: > >>> indicies = [i for i in xrange(len(mystring)) if > mystring.startswith(substr, i)] > >>> indicies > [4, 8, 10, 17, 22] > > is my preferred way of doing this.
it's things like this that makes me wonder why I spent a week speeding up the string implementation for Python 2.5 (with special emphasis on find/index-related performance)... </F> -- http://mail.python.org/mailman/listinfo/python-list