擅长:python、mysql、java
<p>我想您可以使用.find()字符串方法</p>
<blockquote>
<p>The find() method returns the index of first occurrence of the
substring (if found). If not found, it returns -1.</p>
</blockquote>
<p>find()方法的语法为:</p>
<pre class="lang-py prettyprint-override"><code>str.find(sub, start, end)
</code></pre>
<p>其中:</p>
<ul>
<li><strong>sub</strong>-它是要在str字符串中搜索的子字符串</李>
<li><strong>开始和结束</strong><em>(可选)</em>-范围str[start:end]在此范围内
搜索子字符串</李>
</ul>