天天看點

python str.endswith

判斷字元串是否以指定字尾結尾,如果以指定字尾結尾傳回True,否則傳回False

suffix -- 該參數可以是一個字元串或者是一個元素。

start -- 字元串中的開始位置。

end -- 字元中結束位置。

endswith(...)

    S.endswith(suffix[, start[, end]]) -> bool

    Return True if S ends with the specified suffix, False otherwise.

    With optional start, test S beginning at that position.

    With optional end, stop comparing S at that position.

    suffix can also be a tuple of strings to try.