Function Details: find

Description


Return the lowest index in the string where substring sub is found.


Extended Description


The find() method searches for the specified substring within the string and returns the lowest index where the substring is found. If the substring is not found, it returns -1. The optional start and end parameters allow you to limit the search to a specific portion of the string.


Read More about find from Python Documentation

Function Signature



Module: builtins

Class: str

Parameters



Parameter List


  • sub: str
  • start: int
  • end: int

Return


Returns the lowest index where the substring is found, or -1 if not found.


Return Type


int

Output

Explanation

This example demonstrates the basic usage of find(). It searches for 'world' in the string.