0
How can i use named group? What is the scenaria?
How can i use named group? What is the scenaria?
1 Respuesta
0
In the group lesson there is a good example:
"import re
pattern = r"(?P<first>abc)(?:def)(ghi)"
match = re.match(pattern, "abcdefghi")
if match:
print(match.group("first"))
print(match.groups())"
here "first" is the name of the group so if match you can get the expresion of that group!