目录
描述
语法及参数
举例
描述
endswith()函数是Python的字符串函数。endswith()用于检测字符串是否以指定字符串开头。如果是则返回True,否则返回False.
语法及参数
str.endswith(str2)
名称 | 含义 | 备注 |
str | 待检测的字符串 | |
str2 | 检测str2字符串是否是str字符串的结尾 | 不可省略的参数 |
举例
>>> pro = "Python."
>>> pro.endswith(".")
True
>>> pro.endswith("Python")
False