Created
October 10, 2018 18:08
-
-
Save selfsame/c0ff1927ea035d2e0f6f2cdf2c37f808 to your computer and use it in GitHub Desktop.
Revisions
-
selfsame created this gist
Oct 10, 2018 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,8 @@ >>> 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')