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).
1727
1727
Return ``True `` if the string ends with the specified *suffix *, otherwise return
1728
1728
``False ``. *suffix * can also be a tuple of suffixes to look for. With optional
1729
1729
*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 `.
1731
1743
1732
1744
1733
1745
.. method :: str.expandtabs(tabsize=8)
You can’t perform that action at this time.
0 commit comments