Count Occurrences of a string
This small script will use Pythons count method to count the numberof occurrences of a string.
s = "Count, the number of spaces."
print s.count(" ")
x = "I like to program in Python"
print x.count("i")
Recommended Python Training
For Python training, our top recommendation is DataCamp.