python学习---搜索字符串中特定字符,返回起始索引

s="I am welcome you!"
world="welcome"
def function():
if world in s:
return s.find(world)
else:
return -1
print(function())
posted @ 2024-02-07 11:39  飞虎就是我  阅读(7)  评论(0编辑  收藏  举报