Computer >> Computer tutorials >  >> Programming >> Python

How to get the length of a string in Python?


Python has a method called len() that gives us the length of any composite object. To get the length of a string, just pass the string to the len() call. For example,

print(len('abcdefghijklmnopqrstuvwxyz'))

OUTPUT

26