Articles → Python → Find Function In PythonFind Function In PythonIn this article, we will discuss the find function in Python.Purpose The find function searches for a substring within a larger string. If the substring is found, the function will return the position (index) of the substring within the larger string. If the substring is not found, the function will return -1.Example str = "this is string example" print("string 'example' is found at position:", str.find("example")) print("string 'xx' is found at position:", str.find("xx"))Output Posted By - Karan Gupta Posted On - Friday, February 22, 2019 Query/Feedback Your Email Id** Subject* Query/Feedback Characters remaining 250**
str = "this is string example" print("string 'example' is found at position:", str.find("example")) print("string 'xx' is found at position:", str.find("xx"))
Query/Feedback