Counting number of occurrences of a character in a Python String
To count the number of occurrences of a character in a string, we can use the
count() function in
Here is an example, that counts number of
o characters in a given string.
str = 'Learn online from anywhere in the world' print(str.count('o')) # Output is 3