# coding:utf-8
'''
count功能:
返回当前字符串中,某个成员(元素)的个数
count用法:
inttype = string.count(item)
参数:item查询个数的元素
count注意事项:
如果查询的成员(元素),不存在,则返回0
'''
info = 'my name is dawei'
print(info.count('e'))
print(info.count('f'))
python-字符串的count函数
最新推荐文章于 2023-07-02 12:06:04 发布