>>> m = re.match(r"(w+) (w+)", "Isaac Newton, physicist")
>>> m[0] # The entire match
'Isaac Newton'
>>> m[1] # The first parenthesized subgroup.
'Isaac'
>>> m[2] # The second parenthesized subgroup.
'Newton'
>>> p = re.compile('(a(b)c)d')
>>> m = p.match('abcd')
>>> m.group(0)
'abcd'
>>> m.group(1)
'abc'
>>> m.group(2)
'b'
Code Example |
---|
:: |
:: |
Python :: |
:: |
Python :: |
Python :: |
:: |
:: |
Python :: |
:: |
:: |
:: fstring |
:: |
:: |
:: |
Python :: |
:: how to use turtle in python in python 3.9 |
:: python define random variables name |
:: |
Python :: |
Python :: python version check in cmd |
:: |
Python :: how to write a while statement in python |
:: |
:: |
Python :: copy website |
:: python from float to decimal |
Python :: |
:: |
:: pandas index to datetime |