Franz Steinhaeusler wrote: > given a string: > > st="abcdatraataza" > ^ ^ ^ ^ (these should be found) > I want to get the positions of all single 'a' characters.
for m in re.finditer("a+", st):
if len(m.group()) == 1:
print m.start()
or, perhaps:
indexes = [m.start() for m in re.finditer("a+", st) if len(m.group()) == 1]
</F>
--
http://mail.python.org/mailman/listinfo/python-list
