# Fifth: The find function that implements a string by itself
# 1. Find another string in a string
# 2. Found where the first occurrence of the return occurred
# 3. Not found return-1
# 4. Parameter S1 is the source string, parameter s2 is the string to find
def index_of_str (S1, S2):
#split这个 function to split the character and return a list of the split elements
Lt=s1.split (S2)
#判断分割后的列表的元素个数, if the number of elements is one, there is only one element in the list stating that there are no S2 characters in S1
If Len (LT) ==1:
Return-1
#多于一个元素, the proof is divided. Using the index function to find the subscript of the S2 element in the list
Else
return S1.index (S2)
s1= "12345678"
S2= "45"
Index_of_str (S1,S2)
Print (Index_of_str (S1,S2))
#知识点梳理, the main practice of Split (), index (), the use of attribute functions, built-in function len () proficiency level
Python exercises the Find function that implements a string by itself