find index的功能
返回你想寻找的成员的位置
find index用法
find
name = "xiaoMixiaomi"
new_name = name.find('ao')
new_name3 = name.find('zhang')
print(new_name)
print(new_name3)
执行结果
2
-1
find如果找不到就会返回-1
name = "xiaoMixiaomi"
new_name = name.index('ao')
print(new_name)
执行结果
2
index如果找不到就会报错