xxxxxxxxxx
# Example usage:
your_string = "Example usage"
len(your_string)
--> 13
xxxxxxxxxx
>>> sentence = 'Mary had a little lamb'
>>> sentence.count('a')
4
xxxxxxxxxx
string='Hi honey, how are you?'
totalcharacterswithoutspace = sum([len(i) for i in string.split()])
print(totalcharacterswithoutspace)
#OUTPUT=18
xxxxxxxxxx
# count the number of characters in a string:
len("The quick brown fox jumps over the lazy dog")
# OUTPUT: 43
# count the number of character OCCURENCES in a string:
string = "The quick brown fox jumps over the lazy dog"
string.count(" ")
# OUTPUT: 8