- In [79]:"Man is a born child, his power is the power of growth. ".count("o")#从整个字符串中统计'o'出现的次数Out[79]: 5
- In [80]:"Man is a born child, his power is the power of growth. ".count("o",0,11)#从位置0到11统计'o'出现的次数Out[80]: 1
来源: http://www.bubuko.com/infodetail-2047242.html