Welcome!

Join our community of MMO enthusiasts and game developers! By registering, you'll gain access to discussions on the latest developments in MMO server files and collaborate with like-minded individuals. Join us today and unlock the potential of MMO server development!

Join Today!

Understanding Python's String find() Method

Initiate Mage
Joined
Jun 21, 2022
Messages
13
Reaction score
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.
Code:
[COLOR=#2E8B70][FONT=Monaco]>>> x = "Hello World"[/FONT][/COLOR]
[COLOR=#2E8B70][FONT=Monaco]>>> x.find('World')[/FONT][/COLOR]
[COLOR=#2E8B70][FONT=Monaco]6[/FONT][/COLOR]
[COLOR=#2E8B70][FONT=Monaco]>>> x.find('Aloha');[/FONT][/COLOR]
[COLOR=#2E8B70][FONT=Monaco]-1[/FONT][/COLOR]
Could you please help me? But I'm not convinced.
 
Experienced Elementalist
Joined
Feb 21, 2012
Messages
283
Reaction score
25
Q: I'd like to know what it returns when it can't find something
A: You can see it in your output with -1 since Aloha is not present in the string at all.

Q: how to specify the starting and ending points
A: It will find the whole string you put inside find function in variable x.
 
Back
Top