Python String Length
String Length
To get the length of a string, use the len()
function.
Example
The len()
function returns the length of a string:
a = "Hello, World!"
print(len(a))
Try it Yourself »
To get the length of a string, use the len()
function.
The len()
function returns the length of a string:
a = "Hello, World!"
print(len(a))
Try it Yourself »
If you want to report an error, or if you want to make a suggestion, do not hesitate to send us an e-mail:
help@w3schools.com
Your message has been sent to W3Schools.