Search substring in a string and get index of all occurances

K.S.Sreeram sreeram at
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.


indices( 'aaaaa', 'aa' )

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


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 260 bytes
Desc: OpenPGP digital signature
URL: <>

More information about the Python-list mailing list