Python 元组 count() 方法用于统计某个元素在元祖,列表,字符串中出现的次数。可选参数为在字符串搜索的开始与结束位置。
例子:
字符串:
a="hello world"
print (a.count("e",1,10)
print (a.count("e")
返回:
》》》1
python count()函数
原文:https://www.cnblogs.com/star12111/p/8881586.html