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