Empowering you to understand your world

How To Get The Length Of A String In Python

By Nicholas Brown

Determining the length of a Python string can be done using the ‘len()’ function as shown below using the variable ‘test1’ as an example:

test1 = "hey"
print( len(test1) )
Subscribe to our newsletter
Get notified when new content is published