Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

Python Exercise Example 60

Python Exercise Example 60

Python 100 Examples Python 100 Examples

**Problem:** Calculate the length of a string.

**Analysis:** None.

Example (Python 2.0+)

#!/usr/bin/python

-- coding: UTF-8 --

sStr1

=

'

strlen

'

print

len

(

sStr1

)

The output of the above example is:


6

Python 100 Examples Python 100 Examples