手机
当前位置:查字典教程网 >脚本专栏 >python >Python中处理字符串的相关的len()方法的使用简介
Python中处理字符串的相关的len()方法的使用简介
摘要:len()方法返回字符串的长度。语法以下是len()方法的语法:len(str)参数NA返回值此方法返回的字符串的长度。例子下面的例子显示了...

len()方法返回字符串的长度。

语法

以下是len()方法的语法:

len( str )

参数

NA

返回值

此方法返回的字符串的长度。

例子

下面的例子显示了len()方法的使用。

#!/usr/bin/python str = "this is string example....wow!!!"; print "Length of the string: ", len(str);

当我们运行上面的程序,它会产生以下结果:

Length of the string: 32

【Python中处理字符串的相关的len()方法的使用简介】相关文章:

Python中字典(dict)和列表(list)的排序方法实例

python的绘图工具matplotlib使用实例

python中stdout输出不缓存的设置方法

python list 合并连接字符串的方法

Python去掉字符串中空格的方法

Python 字符串操作方法大全

Python程序设计入门(3)数组的使用

python中文乱码的解决方法

python 中文字符串的处理实现代码

python使用正则搜索字符串或文件中的浮点数代码实例

精品推荐
分类导航