一.字符串方法
-
count(sub,[start,end] )
'abcabcab'.count('ab')---结果3
'abcabcab'.count('ab',2)---从第三个字符开始到末尾统计出现ab次数,结果2
2.endswith(sub,[start,end])
判断范围内是否以字符串sub结尾
3.startwith(sub,[start,end])
判断是否以sub开头
4.find(sub,[start,end])
范围内查找字符串sub,返回的是第一次位置偏移量
5.格式化
format(args)
'My name is {0},age is {1}'.format('Tom',23)---'My name is Tom,age is 23'