N
Nico Grubert
Hi there,
I would like to search for a substring in a string and get the index of
all occurances.
mystring = 'John has a really nice powerbook.'
substr = ' ' # space
I would like to get this list:
[4, 8, 10, 17, 22]
How can I do that without using "for i in mystring" which might be
expensive for large strings?
Thanks in advance,
Nico
I would like to search for a substring in a string and get the index of
all occurances.
mystring = 'John has a really nice powerbook.'
substr = ' ' # space
I would like to get this list:
[4, 8, 10, 17, 22]
How can I do that without using "for i in mystring" which might be
expensive for large strings?
Thanks in advance,
Nico