-1
match_next = re.search(r'(再来週)の(.曜日)', '再来週の月曜日') 

when I run match_next.group[1], I got the following:

TypeError: 'builtin_function_or_method' object is not subscriptable

Even if the match fails, why does the group function report this error?

ling
  • 1,555
  • 3
  • 18
  • 24

1 Answers1

1

The docs have the properties and how to use them. Basically the group method of the Match Object should be called with 1 or more integers indicating which groups you want to access.

match_next = re.search(r'(再来週)の(.曜日)', '再来週の月曜日')
match_next.group(1)
Buckeye14Guy
  • 831
  • 6
  • 12