0

What is the difference between rfind() & index()?

12th Jun 2020, 9:19 PM
Hassan elkady`
Hassan elkady` - avatar
2 Answers
+ 3
The answer from programiz is this.... The rindex() method is similar to rfind() method for strings. The only difference is that rfind() returns -1 if the substring is not found, whereas rindex() throws an exception. https://www.programiz.com/JUMP_LINK__&&__python__&&__JUMP_LINK-programming/methods/string/rindex#:~:text=The%20rindex()%20method%20is,rindex()%20throws%20an%20exception. The code is based on their direct scripts https://code.sololearn.com/cqPffKDkJ6bP/?ref=app
12th Jun 2020, 10:00 PM
BroFar
BroFar - avatar