Reputation: 703
suppose I have a string:
some_string = 'https://api.github.com/repos/username/repo-name'
How do I move from right to left and stop at the first occurrence of /
such that what is returned will be repo-name
?
Upvotes: 0
Views: 350
Reputation: 118
some_string.rfind("/")
will return the right-most index of a given character.
Upvotes: 1