count occurances of all characters python code example Example: python count character occurrences str1.count("a")