Created
October 10, 2018 18:08
-
-
Save selfsame/c0ff1927ea035d2e0f6f2cdf2c37f808 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
>>> p = r"rip (?P<thing>.+) from (?P<object>.+)" | |
>>> re.search(p, "rip sheet from red book") | |
<_sre.SRE_Match object; span=(0, 23), match='rip sheet from red book'> | |
>>> res = re.search(p, "rip sheet from red book") | |
>>> res.groups | |
<built-in method groups of _sre.SRE_Match object at 0x7fa2c61e2938> | |
>>> res.groups() | |
('sheet', 'red book') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment