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 5 string = "geeks" print(len(string)) # Length of below string is 15 string = "geeks for geeks" print(len(string)) |
Output:
5 15
Recommended Posts:
- Python - Length of shortest string in string list
- Python - Smallest Length String
- Python - Maximum String value length of Key
- Python | Extract odd length words in String
- Python - Custom length tuples from String
- Python | Average String length in list
- Find length of a string in python (4 ways)
- Python | Generate random string of given length
- Python program to print even length words in a string
- Python | Padding a string upto fixed length
- Python | Extract length of longest string in list
- Python - Dictionary values String Length Summation
- Find the length of each string element in the Numpy array
- Modify Numpy array to store an arbitrary length string
- Python | Check if given string can be formed by concatenating string elements of list
- String slicing in Python to check if a string can become empty by recursive deletion
- Python - Remove front K characters from each string in String List
- Python | Merge Tuple String List values to String
- Run Length Encoding in Python
- Python - Value length dictionary
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.

