String build-in function - len
len is a build-in function that returns the numbers of characters in a string:

Since we started counting at zero, the last index should be 5.
Alternatively, you can use negative indices, which count backward from the end of the string. The expression fruit[-1] yields the last letter, fruit[-2] yields the second to last, and so on.

The reason for index error is that no letter in ‘banana’ with the index -10. The first letter’s index should be fruit[-6].
from Thinking in Python
String build-in function - len的更多相关文章
- Entity Framework 6 执行Linq to Entities异常"p__linq__1 : String truncation: max=0, len=2, value='测试'"
场景再现 我需要查询公司名称包含给定字符串的公司,于是我写了下面的测试小例子: var condition = "测试"; var query = from b in db.Com ...
- String类型,Function类型
1.String类型: 1)创建String对象: var str=new String(s); String(s); 参数:参数 s 是要存储在 String 对象中的值或转换成 ...
- c++中string::function集合
string append() 1.直接添加另一个完整的字符串: str1.append(str2); 2.添加另一个字符串的某一段字串: str1.append(str2, 11, 7); ...
- the simmon effect(in psychology) :build the function of subject_information(modify the experiment programme),before we begin the experiment
#the real experiment for simon effect #load the library which is our need import pygame import sys i ...
- simon effect (psychology experiment ) : build the function of wait4key()
## #the real experiment for simon effect #load the library which is our need import pygame import sy ...
- 高精度运算专题-输出函数与字符串转数字函数(Output function and the string to number function)
输出函数:这个函数别看它小,但浓缩的都是精华啊 作用:对于高精度的数组进行倒序输出 思路:首先从被传入的数组第一位开始,一直往前扫输出就可以了(i--) 注释:因为每个数组的第一位是用来存储这个数组的 ...
- JS中的PadLeft、PadRight,位数不足,自动补位,String扩展方法
类似C#中的 PadLeft.PadRight方法 //方法一 function FillZero(p) { return new Array(3 - (p + '').length + 1).joi ...
- Js String 属性扩展
String.prototype.startsWith = function (startStr) { var d = startStr.length; return (d >= 0 &am ...
- util.string.js
ylbtech-JavaScript-util: util.string.js 字符串处理工具 1.A,JS-效果图返回顶部 1.B,JS-Source Code(源代码)返回顶部 1.B.1, ...
随机推荐
- cocos2d-x学习笔记(18)--游戏打包(windows平台)
cocos2d-x学习笔记(18)--游戏打包(windows平台) 之前做好的游戏,都是在vs2008下编译执行的.假设说想把游戏公布到网上或者和其它人一起分享游戏,那就得对游戏 ...
- 疯狂Java学习笔记(70)-----------挚爱Java
与大家分享! 挚爱Java 10个使用Java最广泛的现实领域 写好Java代码的30条经验总结 Java字符串的substring真的会引起内存泄露么? Java内存的原型及工作原理深度剖析 Jav ...
- SEO分享:关于SEO的十个问题
想写的幽默一点,幽默细胞太少,想写的专业一点,又不够专业,结果就出现了这篇不伦不类的怪文,望海涵! 导读:前面写过一篇类似的文章,受到的评价好坏都有吧.有人说讲的没有实质性的内容,有些人抱怨回答的太过 ...
- 换今日特价图片---轻开电子商务系统(企业入门级B2C站点)
跟换主页轮播图片一样,一共4个文件: 列表显示文件:site/links/img2.html 加入图片文件:site/links/img2_add.html 加入保存图片文件:site/links/i ...
- 怎样用批处理来执行多个exe文件
怎样用批处理来运行多个exe文件 @echo off start *****.exe start *****.exe start *****.exe start *****.exe 接着我们就能够运行 ...
- extjs 时间范围选择的实现
extjs中 有时须要选择一个日期范围 ,须要自己主动推断,选择的開始日期不能大于结束日期,或结束日期不能小于開始日期,实现的代码例如以下 效果图: watermark/2/text/aHR0cDov ...
- ZOJ 3689 Digging(贪心+dp)
Digging Time Limit: 2 Seconds Memory Limit: 65536 KB When it comes to the Maya Civilization, we ...
- 英语影视台词---七、THE GREAT GATSBY QUOTES
英语影视台词---七.THE GREAT GATSBY QUOTES 一.总结 一句话总结:了不起的盖茨比 1.“So we beat on, boats against the current, b ...
- ES transport client底层是netty实现,netty本质上是异步方式,但是netty自身可以使用sync或者await(future超时机制)来实现类似同步调用!因此,ES transport client可以同步调用也可以异步(不过底层的socket必然是异步实现)
ES transport client底层是netty实现,netty本质上是异步方式,但是netty自身可以使用sync或者await(future超时机制)来实现类似同步调用! 因此,ES tra ...
- sql中计算百分比
sql中计算百分比:(转成字符串然后拼接%) ),) AS CHAR),'%') as aa from act_canal; 效果: