regex definition:
(?P<zip>...)
Creates a named zip group
Zip:\s*
Match “Zip:” with Zero or More Whitespace
\d
Corresponds to the number
\w
Matches the word character [A-Za-z0-9 _]
y.groupdict('zip')
The groupdict method returns a dictionary with named groups as keys and their matches as values. In this case, a match is returned for the zip group
y.group(2)
Return a match for the second group, which is the nameless group "(...)"
Hope this helps.
SchaeferFFM
source share