Answers for "how to read character count in python"

10

count characters in string python

>>> sentence = 'Mary had a little lamb'
>>> sentence.count('a')
4
Posted by: Guest on December-30-2020
0

count characters in string python

# 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
Posted by: Guest on March-29-2022

Code answers related to "how to read character count in python"

Python Answers by Framework

Browse Popular Code Answers by Language