我是靠谱客的博主 傲娇月光,这篇文章主要介绍Python Basic - endswith(" ")---判断是否是相应的字符串结束先定义几个字符串变量,现在分享给大家,希望可以做个参考。

文章目录

  • 先定义几个字符串变量
    • endswith(" ")---判断是否是相应的字符串结束

先定义几个字符串变量

复制代码
1
2
3
4
5
6
string1 = "Hello,World." string2 = "Python is the best computer language" string3 = "Python is the language that the most easy of thetworld." string4 = "3 is bigger than 1" string5 = "Python is the {what} that the most {how} of the world."

endswith(" ")—判断是否是相应的字符串结束

复制代码
1
2
print(string3.endswith("world.")) # 给出一个字符,判断字符串所存储的字符是否是以给定的字符串结尾的,返回值为true/false的布尔值。

以下为返回值

复制代码
1
2
3
4
5
6
7
“”“ True ”““ ··· ### [查看全部内置字符串处理方法,请点击](https://blog.csdn.net/Huangfei10086/article/details/105674736)

最后

以上就是傲娇月光最近收集整理的关于Python Basic - endswith(" ")---判断是否是相应的字符串结束先定义几个字符串变量的全部内容,更多相关Python内容请搜索靠谱客的其他文章。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(128)

评论列表共有 0 条评论

立即
投稿
返回
顶部