def strStr(haystack,needle): len1=len(needle) if len1==0: return 0 for i in range(len(haystack)): if haystack[i:i+len1]==needle: return i return -1
原文地址:https://www.cnblogs.com/zhangtianxia/p/9038426.html
时间: 2024-10-03 14:42:06
def strStr(haystack,needle): len1=len(needle) if len1==0: return 0 for i in range(len(haystack)): if haystack[i:i+len1]==needle: return i return -1
原文地址:https://www.cnblogs.com/zhangtianxia/p/9038426.html