find string method in Python

The find() method finds the first occurrence of the specified value. The find() method returns -1 if the value is not found.

Example 1:

str = "------hello Dmitri--------"
print(str.find("Dmi"))
Output 1:
12
Example 2:
str = "------hello Dmitri--------"
print(str.find("mdi"))
Output 2:
-1