Answer the question
In order to leave comments, you need to log in
start method in python
Good day, I'm a beginner in python, so excuse me if the question is completely stupid, but Google could not answer me (or I asked incorrectly).
Today I was browsing stackoverflow and came across this line of code.
[m.start() for m in re.finditer(r"ab",s)][n]
Actually, this line returns the index of the nth occurrence of the substring ab in the string s.
Actually the question is: how does it work?
I wandered through the Python help, I didn’t find anything sensible about this start. The standard dir didn't give me any answers either.
Finditer returns, which is logical, an iterator, judging by the Python help, but this did not explain the situation to me.
Thank you in advance.
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question