如何计算给定子字符串在Python字符串中出现的次数?
例如:
>>> 'foo bar foo'.numberOfOccurrences('foo') 2
string.count(substring), 像:
string.count(substring)
>>> "abcdabcva".count("ab") 2