Write str.count(sub[, start[, end]).
Returns the strong result of sub
within the range of [start, end]
.
m = "kkkkaa"
print "m.count('kk'):\t\t", m.count("kk")
print "m.count('a'):\t\t", m.count("a")
print "m.count('a', 0, 2):", m.count("a", 0, 2)
Result:
m.count('kk'): 2
m.count('a'): 2
m.count('a', 0, 2): 0
© 2024 OneMinuteCode. All rights reserved.