The Wayback Machine - https://web.archive.org/web/20210427132633/https://www.geeksforgeeks.org/python-string-length-len/
Skip to content
Related Articles

Related Articles

Python string length | len()
  • Difficulty Level : Basic
  • Last Updated : 07 Jan, 2018

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
My Personal Notes arrow_drop_up
Recommended Articles
Page :