Findall Method
findall()
is a method that returns a list containing all matches of the pattern in the given string.
Aufgabe
Swipe to start coding
- Define a text variable with
"The cat is cute. The dog is also cute."
. - Use the
findall()
method and print the results.
Lösung
import re
text = "The cat is cute. The dog is also cute."
x = re.findall("cute", text)
print(x) # Output: ['cute', 'cute']
Mark tasks as Completed
War alles klar?
Danke für Ihr Feedback!
Abschnitt 1. Kapitel 8