how to see how many times a substring is in a string python code example Example: python count character occurrences str1.count("a")