Python string length | len()
len() function is an inbuilt function in Python programming language that returns the length of the string.
Syntax:
len(string)
Parameters:
It takes string as the parameter.
Return Value:
It returns an integer which is the length of the string.
Below is the Python implementation of the len() method.
# Python program to demonstrate the use of# len() method # Length of below string is 5string = "geeks" print(len(string)) # Length of below string is 15string = "geeks for geeks" print(len(string)) |
Output:
5 15
Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.
To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course. And to begin with your Machine Learning Journey, join the Machine Learning – Basic Level Course


