Python Program to Count the Number of Occurrences of a Character in a String Using count() Function
# Count the Number of Occurrences of a Character in String Using method count() in Python my_string = "Hello" my_char = "l" print(my_string.count(my_char))
Output
2