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 @@ -1834,7 +1834,19 @@ expression support in the :mod:`re` module).
1834
1834
Return ``True `` if the string ends with the specified *suffix *, otherwise return
1835
1835
``False ``. *suffix * can also be a tuple of suffixes to look for. With optional
1836
1836
*start *, test beginning at that position. With optional *end *, stop comparing
1837
- at that position.
1837
+ at that position. Use the *start * and *end * is equivalent to
1838
+ ``str[start:end].endswith(suffix) ``. For example::
1839
+
1840
+ >>> 'Python'.endswith('on')
1841
+ True
1842
+ >>> 'a tuple of suffixes'.endswith(('at', 'in'))
1843
+ False
1844
+ >>> 'a tuple of suffixes'.endswith(('at', 'es'))
1845
+ True
1846
+ >>> 'Python is amazing'.endswith('is', 0, 9)
1847
+ True
1848
+
1849
+ See also :meth: `startswith ` and :meth: `removesuffix `.
1838
1850
1839
1851
1840
1852
.. method :: str.expandtabs(tabsize=8)
You can’t perform that action at this time.
0 commit comments