How to get the length of a string in Python?

PythonServer Side ProgrammingProgramming

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
raja
Published on 11-Dec-2017 12:02:43
Advertisements