Created
August 31, 2015 22:39
-
-
Save anonymous/9818f59cfa05e4d0c645 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(search, target): | |
pos = 0 | |
position = search.find(target) | |
if position < 0: | |
return position | |
else: | |
while position >= 0: | |
first_pos = search.find(target) | |
position = search.find(target, first_pos + pos) | |
pos = pos + 1 | |
if position < 0: | |
break | |
return position | |
else: | |
final_pos = search.find(target, position) | |
return final_pos |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment