find() string method in Python

The find() is a built-in string method returns the lowest index of substring (first occurrence).

Syntax string.find(substring, start, end)

Example:

Python

text = "python programming"
print(text.find("pro"))   # Output: 7

Special Note: Returns -1 if substring is not found.