Python 3 - String len() Method


Description

The len() method returns the length of the string.

Syntax

Following is the syntax for len() method −

len( str )

Parameters

NA

Return Value

This method returns the length of the string.

Example

The following example shows the usage of len() method.

#!/usr/bin/python3

str = "this is string example....wow!!!"
print ("Length of the string: ", len(str))

Result

When we run above program, it produces the following result −

Length of the string:  32
python_strings.htm
Advertisements