# Python string find() examples



## Sachinbhatt (17. Okt 2022)

I'm looking for examples but am having no luck.
Is anyone aware of any examples on the internet? I'd like to know what it returns when it can't find something, and how to specify from start to end, which I assume will be 0, -1.

```
>>> x = "Hello World"
>>> x.find('World')
6
>>> x.find('Aloha');
-1
```
Could someone please assist me? But I'm not sure about it.


----------



## KonradN (17. Okt 2022)

Are you looking for a reference? That could be found at:








						Python String find() Method
					

W3Schools offers free online tutorials, references and exercises in all the major languages of the web. Covering popular subjects like HTML, CSS, JavaScript, Python, SQL, Java, and many, many more.




					www.w3schools.com
				











						Python String Methods
					

W3Schools offers free online tutorials, references and exercises in all the major languages of the web. Covering popular subjects like HTML, CSS, JavaScript, Python, SQL, Java, and many, many more.




					www.w3schools.com
				




So find takes the arguments:

String to search for
Optional: start
Optional: end
and it returns the index where the text is found or -1 if it cannot find the string you are looking for.


----------

