mishrajicoder
New Member
- Joined
- Oct 17, 2022
- Messages
- 6
- Thread Author
- #1
I'm looking for examples, but I'm not finding any.
Are there any examples on the internet? I'd like to know what it returns when it can't find something, as well as how to specify the starting and ending points, which I assume will be 0, -1.
Could you please help me? But I'm not convinced.
Are there any examples on the internet? I'd like to know what it returns when it can't find something, as well as how to specify the starting and ending points, which I assume will be 0, -1.
Python:
>>> x = "Hello World"
>>> x.find('World')
6
>>> x.find('Aloha');
-1
- Joined
- Jul 4, 2015
- Messages
- 8,980
mishrajicoder
New Member
- Joined
- Oct 17, 2022
- Messages
- 6
- Thread Author
- #3
Thanks for the clarification!
If a match isn't found it will return -1. If found it returns the starting index. Indexes start at 0 which is the beginning of the string
AlishS
New Member
- Joined
- Oct 27, 2022
- Messages
- 9
Similar threads
- Replies
- 2
- Views
- 442
- Replies
- 1
- Views
- 407
- Replies
- 0
- Views
- 741
- Replies
- 6
- Views
- 527