-
-
Save eevee/79fdf1329b3a77d59dbd to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def find_last(haystack, needle): | |
last_pos = -1 | |
while True: | |
next_pos = haystack.find(needle, last_pos + 1) | |
if next_pos < 0: | |
return last_pos | |
last_pos = next_pos |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment