Details of Python re operation method of
- 2020-06-03 07:14:47
1: re. search():search returns the object of the lookup result, and you can use the group() or groups() methods to get a matching string.
group() by default returns the entire string of a successful match (ignoring the parentheses in pattern), or you can specify the number of strings in the parentheses that return a successful match (counting from 1);
groups() returns the contents of the parentheses in pattern that match successfully as a tuple, or empty tuples if there are no parentheses in pattern.