File tree Expand file tree Collapse file tree 1 file changed +13
-1
lines changed Expand file tree Collapse file tree 1 file changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -1727,7 +1727,19 @@ expression support in the :mod:`re` module).
17271727 Return ``True `` if the string ends with the specified *suffix *, otherwise return
17281728 ``False ``. *suffix * can also be a tuple of suffixes to look for. With optional
17291729 *start *, test beginning at that position. With optional *end *, stop comparing
1730- at that position.
1730+ at that position. Using *start * and *end * is equivalent to
1731+ ``str[start:end].endswith(suffix) ``. For example::
1732+
1733+ >>> 'Python'.endswith('on')
1734+ True
1735+ >>> 'a tuple of suffixes'.endswith(('at', 'in'))
1736+ False
1737+ >>> 'a tuple of suffixes'.endswith(('at', 'es'))
1738+ True
1739+ >>> 'Python is amazing'.endswith('is', 0, 9)
1740+ True
1741+
1742+ See also :meth: `startswith ` and :meth: `removesuffix `.
17311743
17321744
17331745.. method :: str.expandtabs(tabsize=8)
You can’t perform that action at this time.
0 commit comments