Python String len() Method
Advertisements
Description
The method len() 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.
Live Demo#!/usr/bin/python str = "this is string example....wow!!!"; print "Length of the string: ", len(str)
When we run above program, it produces following result −
Length of the string: 32
python_strings.htm
Advertisements