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 »
print(len(a))
Related Pages
Python Strings Tutorial String Literals Assigning a String to a Variable Multiline Strings Strings are Arrays Slicing a String Negative Indexing on a String Check In String Format String Escape Characters