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)adddifferencedifference_updatediscardintersectionintersection_updateisdisjointissubsetissupersetremove_(set)remove_(list)symmetric_differencesymmetric_difference_updateunionupdateclosefilenoflushisattyreadreadablereadlinereadlinesseekseekabletelltruncatewritablewritewritelinesappendextendinsertreversesortcapitalizecasefoldcenterencodeendswithexpandtabsfindformatisalnumisalphaisasciiisdecimalisdigitisidentifierislowerisnumericisprintableisspaceistitleisupperjoinljustlowerlstripmaketranspartitionreplacerfindrindexrjustrpartitionrsplitrstripsplitsplitlinesstartswithstripswapcasetitletranslateupperdirzfillFunction Details: index_(str)
Description
Returns the lowest index where the substring is found.
Extended Description
index is a Python string method that finds first occurrence of substring and returns its position. Similar to find but raises ValueError when substring not found, making it stricter. Works with rindex for searching from right side. Accepts optional start and end parameters for search range. Partners with split and partition for text parsing. Often used when substring must exist, making error handling explicit. Essential for string validation and strict text processing workflows.
Function Signature
str.index(sub: str, start: int = 0, end: int = None) -> int
Module: str
Class: str
Parameters
Parameter List
- sub: str
- start: int
- end: int
Return
Returns an integer representing the lowest index where the substring is found.
Return Type
int
Output
Explanation
This example shows finding the index of substrings in the string.