On Tue, 14 Dec 2004 14:19:35 +0100, "Fredrik Lundh"
<[EMAIL PROTECTED]> wrote:
>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>
>
>
Great!
thank you for your quick and helpful reply!
--
Franz Steinhaeusler
--
http://mail.python.org/mailman/listinfo/python-list