45-python基础-python3-字符串-常用字符串方法(三)

4-字符串方法 startswith()和 endswith()

  • startswith()和 endswith()判断字符串是否以某个字符串开始或结尾,存在返回 True,否则,方法返回 False。

实例1:

实例2:

猜你喜欢

转载自www.cnblogs.com/summer1019/p/11369657.html