功能:
Python3 startswith()方法可以指定区间检测一个源字符串时候以另一个字符串开头。
语法:str.startswith(str2, [start=0,end=len(string)]);参数说明:
str:需要检测的源字符串
str2:指定字符串,就是需要以之开头的字符串
start:可选参数,默认为0,意为指定开始检测的位置
end:可选参数,默认为源字符串长度,意为指定结束检测的位置
返回值:
如果检测是以指定字符串开头则返回True,否则返回False。
注意事项:
1、其余字符串方法见:http://www.mihuguan.com/article/15703730746.html
实例说明:
>>> str="hello mihuguan" >>> str.startswith('he') True >>> str.startswith('llo',2) True
jQuery2021-01-08
jQuery2021-01-07
MySQL2020-12-13
电脑2020-12-12
服务器2020-12-06
电脑2020-10-06