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
Course: Python 3 For Beginners
Over 15 hours of video content with guided instruction for beginners. Learn how to create real world applications and master the basics.