meine Frage bezieht sich auf die findall Funktion:
Code: Alles auswählen
match = r.findall(text)
for im in match:
Danke für jede Antwort
Code: Alles auswählen
match = r.findall(text)
for im in match:
Code: Alles auswählen
>>> m = re.match(r"(\w+) (\w+)", "Isaac Newton, physicist")
>>> m.group(0) # The entire match
'Isaac Newton'
>>> m.group(1) # The first parenthesized subgroup.
'Isaac'
>>> m.group(2) # The second parenthesized subgroup.
'Newton'
>>> m.group(1, 2) # Multiple arguments give us a tuple.
('Isaac', 'Newton')
Nein, ``findall()`` gibt eine Liste zurück. ``match()`` gibt Match-Objekte.jens hat geschrieben:Es ist ein match object: http://docs.python.org/dev/library/re#id1
mondschein hat geschrieben:ne schon ok...hab grad meinen denkfehler selber bemerkt, aber habe eine andere frage:
gibt es eine möglichkeit zu gucken wie oft ein bestimmtes wort in im vorkommt?
Code: Alles auswählen
count = im.count(wort)