Examples for string find() in Python

Programming, for all ages and all languages.
Post Reply
OptymizeSo
Posts: 1
Joined: Tue Jun 21, 2022 2:59 am

Examples for string find() in Python

Post by OptymizeSo »

I am trying to find some examples but no luck.

Does anyone know of some examples on the net? I would like to know what it returns when it can't find, and how to specify from start to end, which I guess is going to be 0, -1.

From Scaler I got the below resolution, but still unsure about it. Need your valuable insights.

Code: Select all

>>> x = "Hello World"
>>> x.find('World')
6
>>> x.find('Aloha');
-1
Post Reply