Question:

Name few methods for matching and searching the occurrences of a pattern in a given text String ?

Answer:

There are 4 different methods in “re” module to perform pattern matching. They are:
match() – matches the pattern only to the beginning of the String. search() – scan the string and look for a location the pattern matches findall() – finds all the occurrences of match and return them as a list
finditer() – finds all the occurrences of match and return them as an iterator.


Keywords:

© 2017 QuizBucket.org