Search (pattern, string[, flags])
Thesearch () function searches forpattern anywhere in string. It has the following arguments:
• patter n— the pattern, as a string, to search for
• flags— one or more of the variables I, IGNORECASE;L,LOCALE ;M,MULTILINE;X, VERBOSE
It returns t mttcP object:
>>> search("199[0-9]$","party like it's 1999") or it returns None, which means the search failed.
>>> search("199[0-9]$","party like it's 2009")
Was this article helpful?