how to get the length of a string in python stack overflow code example

Example 1: how to get the length of a string in python stack overflow

string = "Hello World"
len(string) # number of characters in string
print(len(string)
      
result: 
11

Example 2: how to get length of string in python

string = "test"
print(len(string))
#>>> Output "4"

Example 3: how to get the length of a string in python stack overflow

>>> s = 'please answer my question'
>>> len(s)  # number of characters in s
25

Tags:

Misc Example