后浪云Python教程:python中len是什么

后浪云Python教程:python中len是什么插图

python Len() 方法返回字符串长度。

len()方法语法:

len( str )

相关推荐:《Python教程》

返回值:

返回字符串长度。

以下实例展示了len()的使用方法:

#!/usr/bin/python
str = "this is string example....wow!!!";
print "字符串长度: ", len(str);

以上实例输出结果如下:

字符串长度: 32
THE END