2 Feb
2003
2 Feb
'03
6:47 p.m.
Am Sun, 2 Feb 2003 19:17:48 +0100 Schrieb Fritz Cizmarov <fritz@sol.at>:
... from string import find
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
das find stammt natürlicha aus dem Modul string. Wenn Du aber nur die Strings zwischen "<bo>" und "</bo>" brauchst, kannst Du schon mit re.findall arbeiten
re.findall("\<bo\>\s*([^\s<]*)\s*\</bo\>",a) ['foo', 'bar']
Gruß Dookie _______________________________________________ Python-de maillist - Python-de@starship.python.net http://starship.python.net/mailman/listinfo/python-de