Python len()返回字符串的长度。
len( str )
此方法返回字符串的长度。
以下示例显示len()方法的用法。
#!/usr/bin/python str="this is string example....wow!!!"; print "Length of the string: ", len(str)
当无涯教程运行上面的程序时,它产生以下输出-
链接:https://www.learnfk.comhttps://www.learnfk.com/python/string-len.html
来源:LearnFk无涯教程网
Length of the string: 32
祝学习愉快!(内容编辑有误?请选中要编辑内容 -> 右键 -> 修改 -> 提交!)