Python ProgrammingPython Programming

How to check if the string is empty or blank?

import re
from collections import Counter
 
sentence = 'Canada is located in the northern part of North America'
# Example I
counter = len(re.findall("a", sentence))
print(counter)
 
# Example II
counter = sentence.count('a')
print(counter)
 
# Example III
counter = Counter(sentence)
print(counter['a'])
Sample output of above program.

Empty
Empty
Empty