Why would one use a named non-capturing group rather than a named group? The example gives ?:def but I fail to see how this is a better way of doing it rather than giving it a name such as <first>
1/14/2017 9:23:48 PM
Never mind, looked at tut comments.
Just remember that the method groups() returns all groups up from 1
num = "07987549836"
pattern = r"9"
num = re.sub(pattern, "0", num)
Learn Playing. Play Learning
Send us a message