count how many times a word appears in a string python code example Example: python count how many times a character appears in a string string.count('a')