Python3 String Endswith
# Python3.x Python3 endswith() Method
[ Python3 Strings](#)
* * *
## Description
The `endswith()` method is used to check if a string ends with a specified suffix. It returns `True` if the string ends with the specified suffix, otherwise it returns `False`. The optional parameters `start` and `end` specify the start and end positions for the search within the string.
## Syntax
The syntax for the `endswith()` method is:
str.endswith(suffix[, start[, end]])
## Parameters
* suffix -- This parameter can be a string or a tuple of strings.
* start -- The starting position within the string.
* end -- The ending position within the string.
## Return Value
Returns `True` if the string contains the specified suffix, otherwise returns `False`.
## Example
The following examples demonstrate the usage of the `endswith()` method:
## Example
#!/usr/bin/python3 Str='Tutorial example....wow!!!'suffix='!!'print(Str.endswith(suffix))print(Str.endswith(suffix,20))suffix='run'print(Str.endswith(suffix))print(Str.endswith(suffix, 0, 19))
The output of the above example is:
TrueTrueFalseFalse
* * Python3 Strings](#)
YouTip