For some questions of method in python find

We know that in python find method is to find its index through the elements, I set the same element multiple times in a string in particular to see the code below, then find a method to view the index of d,

I returned it to 0, then I think that if there are multiple strings of the same elements you will find the method returns the index of the first element you want it encounters, but the second shift experiments I understand push

Overturned and a second trial I want to find dqwd index, we can see here the first time I guess if in accordance with the experiment, can I return to 0, but I do not know why it was returned to 3, although the index

3 is correct, but why not give it 0 I return? I hope you can answer my questions seniors, to express my gratitude.

name=’dqwdqwdqw'

print(name.find('d'))

The output is: 0

Second test

print(name.find('dqwd'))

The output is: 3

Guess you like

Origin www.cnblogs.com/ljqyugbl/p/12040322.html