MeshWorld India LogoMeshWorld.
ProgramPythonTutorial1 min read

How to Find String Length in Python Using len()

Vishnu
By Vishnu
How to Find String Length in Python Using len()

A tutorial for finding the length of a string using len() in Python Programming Language

  • The len() function counts the number of characters in a given string and returns the long unsigned integer value.
  • It is an in-built function in Python PL.
  • It returns the count of items in an object.
  • When the object type is string, len() function returns count of characters in the given string.
demoString = "Earth is a beautiful planet in Solar System";
len(demoString);

Working example

planet = "Earth", title = "MeshWorld";

print("Using len for planet: ", len(planet));
print("Using len for title: ", len(title));

Output

Using len for planet: 5
Using len for title: 9

Hope you like this!

Keep helping and happy 😄 coding

Share_This Twitter / X
Vishnu
Written By

Vishnu

Founder & Principal Architect at MeshWorld. Senior engineer and instructor specializing in AI agent systems, scalable web architecture, and modern development workflows.

Enjoyed this article?

Support MeshWorld and help us create more technical content