Question #5990   Submitted by Answiki on 03/01/2022 at 08:08:01 PM UTC

In Python, how to know the number of characters in a string?

Answer   Submitted by Answiki on 03/01/2022 at 08:11:02 PM UTC

In Python, the len() function returns the number of characters in a string. For example:

>>> string = "Hello world";
>>> print ("Number of characters : ", len(string))
Number of characters :  11



3 events in history
Answer by Answiki on 03/01/2022 at 08:11:02 PM

In Python, the len() function returns the number of characters in a string. For example:

>>> string = "Hello world";
>>> print ("Number of characters : ", len(string))
Number of characters :  11



Question by Answiki 03/01/2022 at 08:08:36 PM
How to get the length of a string in Python?
Question by Answiki 03/01/2022 at 08:08:01 PM
In Python, how to know the number of characters in a string?
# ID Query URL Count

Icons proudly provided by Friconix.