自己的解法
class Solution:
def strStr(self, haystack: str, needle: str) -> int:
if len(needle) == 0:
return 0
if needle in haystack:
mark = True
else:
return -1
if mark ==True:
for i in range(len(haystack)):
if haystack[i: i + len(needle)] == needle:
return i