擅长:python、mysql、java
<blockquote>
<p><a href="https://docs.python.org/2/library/stdtypes.html#str.count" rel="noreferrer">str.count(sub[, start[, end]])</a></p>
<p>Return the number of non-overlapping occurrences of substring <code>sub</code> in the range <code>[start, end]</code>. Optional arguments <code>start</code> and <code>end</code> are interpreted as in slice notation.</p>
</blockquote>
<pre><code>>>> sentence = 'Mary had a little lamb'
>>> sentence.count('a')
4
</code></pre>