Scroll Down to See All▾
absaiterallanextanyasciibinboolbreakpointbytearraybytescallablechrclassmethodcompilecomplexdelattrdictdivmodenumerateevalexecfilterfloatformatfrozensetgetattrglobalshasattrhashhelphexidinputintisinstanceissubclassiterlenlistlocalsmapmaxmemoryviewminnextobjectoctopenordpowprintpropertyrangereprreversedroundsetsetattrslicesortedstaticmethodstrsumsupertupletypevarszipclear_(dict)clear_(list)clear_(set)copy_(dict)copy_(list)copy_(set)fromkeysgetitemskeyspop_(dict)pop_(list)pop_(set)popitemsetdefaultupdatevaluescount_(tuple)count_(list)count_(str)index_(tuple)index_(list)index_(str)adddifferencedifference_updatediscardintersectionintersection_updateisdisjointissubsetissupersetremove_(set)remove_(list)symmetric_differencesymmetric_difference_updateunionupdateclosefilenoflushisattyreadreadablereadlinereadlinesseekseekabletelltruncatewritablewritewritelinesappendextendinsertreversesortcapitalizecasefoldcenterencodeendswithexpandtabsfindformatisalnumisalphaisasciiisdecimalisdigitisidentifierislowerisnumericisprintableisspaceistitleisupperjoinljustlowerlstripmaketranspartitionreplacerfindrjustrpartitionrsplitrstripsplitsplitlinesstartswithstripswapcasetitletranslateupperdirzfillFunction Details: rindex
Description
Returns the highest index in the string where substring sub is found.
Extended Description
rindex is a Python string method that returns position of last occurrence of substring. Similar to rfind but raises ValueError when substring not found, offering stricter validation. Works with index for bidirectional search. Takes optional start and end parameters for search range. Partners with split and rpartition for text parsing. Used when substring must exist and searching from right is needed. Essential for validation and strict text processing from string's end.
Read More about rindex from Python Documentation
Function Signature
Module: builtins
Class: str
Parameters
Parameter List
- sub: str
- start: int
- end: int
Return
Returns the highest index where the substring is found.
Return Type
int
Output
Explanation
This example demonstrates the basic usage of rindex(). It finds the last occurrence of 'hello'.