中文字幕一区二区人妻电影,亚洲av无码一区二区乱子伦as ,亚洲精品无码永久在线观看,亚洲成aⅴ人片久青草影院按摩,亚洲黑人巨大videos

Python endswith()方法

Python 字符串 Python 字符串


描述

Python endswith() 方法用于判斷字符串是否以指定后綴結尾,如果以指定后綴結尾返回True,否則返回False??蛇x參數(shù)"start"與"end"為檢索字符串的開始與結束位置。

語法

endswith()方法語法:

str.endswith(suffix[, start[, end]])

參數(shù)

  • suffix -- 該參數(shù)可以是一個字符串或者是一個元素。
  • start -- 字符串中的開始位置。
  • end -- 字符中結束位置。

返回值

如果字符串含有指定的后綴返回True,否則返回False。

實例

以下實例展示了endswith()方法的實例:

實例(Python 2.0+)

#!/usr/bin/python str = "this is string example....wow!!!"; suffix = "wow!!!"; print str.endswith(suffix); print str.endswith(suffix,20); suffix = "is"; print str.endswith(suffix, 2, 4); print str.endswith(suffix, 2, 6);

以上實例輸出結果如下:

True
True
True
False

Python 字符串 Python 字符串

其他擴展