Python String rfind() MethodPython rfind() method finds a substring in in the string and returns the highest index. It means it returns the index of most righmost matched subtring of the string. It returns -1 if substring not found. SignatureParameterssub : substring to be searched. start (optional) : starting index to start searching. end (optional) : end index where to search stopped. ReturnIt returns either index of substring or -1. Let's see some examples of rfind() method to understand it's functionality. Python String rfind() Method Example 1Let's have a simple example to implement the rfind() method. It returns highest index of the substring. Output: 16 Python String rfind() Method Example 2One more example to understand the working of rfind() method. Output: 18 Python String rfind() Method Example 3This method takes other three parameters including two optional. Let's provide start and end index to the method. Output: 18 6 Next TopicPython Strings |
We provides tutorials and interview questions of all technology like java tutorial, android, java frameworks
G-13, 2nd Floor, Sec-3, Noida, UP, 201301, India