0

Why this program is not working?

patternu = r"a(bc)(f(g(h))(de)i" match = re.match(patternu, "abcfghdeijklmnop") if match: print(match.group()) print(match.group(0)) print(match.group(1)) print(match.group(2)) print(match.groups()) print(match.group(3)) print(match.group(4)) print(match.group(5)) print(match.group(6))

22nd Feb 2018, 2:22 PM
Azazul Islam
Azazul Islam - avatar
1 Resposta
0
well, a ")" is missing and there is only 6 groups (index from 0 to 5). Here is fixed code: https://code.sololearn.com/csFEVGM68mnQ/?ref=app
24th Jul 2018, 4:50 AM
Cristian Baeza Jimenez
Cristian Baeza Jimenez - avatar