Skip to content

Instantly share code, notes, and snippets.

@eevee
Forked from anonymous/gist:9818f59cfa05e4d0c645
Last active August 31, 2015 22:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save eevee/79fdf1329b3a77d59dbd to your computer and use it in GitHub Desktop.
Save eevee/79fdf1329b3a77d59dbd to your computer and use it in GitHub Desktop.
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