擅长:python、mysql、java
<p><strong>find()</strong>函数在未找到任何匹配项时返回<strong>-1</strong>,在找到匹配项时返回<strong>0</strong>,您可以通过替换此函数来实现解决方案</p>
<pre><code>if string.find(sub_string,i,i+length)>=0:
</code></pre>
<p>内部<strong>for loop</strong></p>
<p>为了更好的理解,请点击下面的链接</p>
<p><a href="https://docs.python.org/2/library/string.html" rel="nofollow noreferrer">https://docs.python.org/2/library/string.html</a></p>
<pre><code>string.find(s, sub[, start[, end]])
</code></pre>
<blockquote>
<p>Return the lowest index in s where the substring sub is found such
that sub is wholly contained in s[start:end]. Return -1 on failure.
Defaults for start and end and interpretation of negative values is
the same as for slices.</p>
</blockquote>