Python Practice Example 60

Python 100例Python 100 Examples

Question:Calculate the length of a string.

Program 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例Python 100 Examples

Other extensions