str.count(sub [,start [,end]])
返回sub范围中的子字符串不重叠的次数
[start, end]。可选参数
start,end并以片表示法解释。
>>> sentence = 'Mary had a little lamb'>>> sentence.count('a')4
str.count(sub [,start [,end]])
返回sub范围中的子字符串不重叠的次数
[start, end]。可选参数
start,end并以片表示法解释。
>>> sentence = 'Mary had a little lamb'>>> sentence.count('a')4