Feb. 2, 2003
6:17 p.m.
Hallo Albert, für Dein Problem wirst Du wohl eine Funktion brauchen, mit den regexpr-Funktionen von Python wird das wohl nicht gehen. def findall(s, sub): erg = [] i = 0 while i < len(s): f = find(s, sub, i) if f < 0: break erg.append(f) i = f+1 return erg
a = "Das ist <bo> foo </bo> das ist <bo> bar </bo> das ist nichts" findall(a, "<bo>") [8, 31] findall(a, "</bo>") [17, 40]
damit bekommst Du alle Indices von "<bo>" und "</bo>" geliefert und kannst damit machen was Du willst. Gruß Dookie _______________________________________________ Python-de maillist - Python-de@starship.python.net http://starship.python.net/mailman/listinfo/python-de