Tutorials  Articles  Notifications  Login  Signup


HS

Harsh Shukla

Intern at Microsoft July 30, 2020, 10:31 a.m. ⋅ 820 views

Python Get length of a string


To get length of a string you can use len() function of python. len() function can be used with several different types in Python - both built-in types and library types.

Have a look at example.

>>> len("HackersFriend")
13

We can also use len() function to get number of items in any python list.

>>> len([1,2,3])
3

 



HackerFriend Logo

Join the community of 1 Lakh+ Developers

Create a free account and get access to tutorials, jobs, hackathons, developer events and neatly written articles.


Create a free account