Is there a more elegant solution to this problem than the following one?
import re
a = 'This module provides regular expression matching operations
a = 'This module provides regular expression matching operations
import re
p = re.compile('(o)')
pos = 0
while p.search(a, pos):
p = re.compile('(o)')
pos = 0
while p.search(a, pos):
... print pos
... pos += 1
output:
6
14
37
49
56
69
73
78
Karl
--
----------------------------------------------------------------------
Karl Schmid
Max-Planck-Institute for Chemical Ecology
Carl-Zeiss-Promenade 10 Tel: +49 3641 / 643658
07745 Jena Fax: +49 3641 / 643669
Germany Email: schmid at ice.mpg.de
======================================================================