Search substring in a string and get index of all occurances

K.S.Sreeram sreeram at tachyontech.net
Wed Jun 21 14:27:14 CEST 2006


Maric Michaud wrote:
> Actually it's even more efficient than Lundh's

effbot's solution finds overlapping occurrences, whereas your solution
finds non-overlapping occurrences. So efficiency comparisons are not valid.

e.g:

indices( 'aaaaa', 'aa' )

your solution gives: 0,2
effbots's solution: 0,1,2,3

Regards
Sreeram


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 260 bytes
Desc: OpenPGP digital signature
URL: <http://mail.python.org/pipermail/python-list/attachments/20060621/3225d82f/attachment.sig>


More information about the Python-list mailing list