How to use str.find() in Python

The str.find(sub) function allows a user to check whether a certain substring exists within a string.

Solution for How to use str.find() in Python : You can use str.find() to find a substring within a string Call str.find(sub) to return the lowest index in which substring sub is found within the string.

If the substring sub is not found, str.find(sub) will return -1.

a_string = "abc abc"


how-to-use-str-find-in-python