Find The Length Of A String In Python

Find the length of a string in Python logo

If you want to find the length of a string in Python it's dead easy! We can just use the built-in print len() function to find it out.

A string is just a series of characters. If we wanted to find the length of a string which is someone's name, we'd just be finding how many letters are in that name.

name = "Pete"

print (len (name))

Output = 4

Check out how Dennis Ivy learned python and sold a website for $40,000.

About the author
Pete Codes

Pete Codes

Hey, I'm Pete and the creator of this site. I am a self-taught web developer and I'm based in Edinburgh, Scotland.

Self-taught developer success stories

Get into tech without a CS degree

Great! You’ve successfully signed up.

Welcome back! You've successfully signed in.

You've successfully subscribed to Self-taught developer success stories.

Success! Check your email for magic link to sign-in.

Success! Your billing info has been updated.

Your billing was not updated.