find() method returns the index value of the first occurrence of the substring in the given string within the specified limit.
|sub||Required||Specifies the substring to be searched.|
|start||Optional||Specifies the index position to start the search.
Default value is 0.
|end||Optional||Specifies the index position to end the search.
Default value is the length of the given string (txt).
|Number||Return the lowest index in the string where substring is found.|
|-1||If the substring is not found.|
Check if position 5 to 32 has the substring "Python":
In the following example, we will find the difference between the
find() and index() methods.