E.g. I have got text:
"John got up. John went to the cinema. John washed his hand."
Now I would like to find first "John" and do something, then I would like to go to next "John" and do something, so I need to use something like findNext(), which considers the actual position, so it will not be finding from the beginning, but from the actual position.
The find-Method has a start-argument:
text = "John got up. John went to the cinema. John washed his hand."
pos = -1
while True:
pos = text.find('John', pos + 1)
if pos == -1:
break
do_something
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With