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 @@ -1863,7 +1863,19 @@ expression support in the :mod:`re` module).
18631863 Return ``True `` if the string ends with the specified *suffix *, otherwise return
18641864 ``False ``. *suffix * can also be a tuple of suffixes to look for. With optional
18651865 *start *, test beginning at that position. With optional *end *, stop comparing
1866- at that position.
1866+ at that position. Using *start * and *end * is equivalent to
1867+ ``str[start:end].endswith(suffix) ``. For example::
1868+
1869+ >>> 'Python'.endswith('on')
1870+ True
1871+ >>> 'a tuple of suffixes'.endswith(('at', 'in'))
1872+ False
1873+ >>> 'a tuple of suffixes'.endswith(('at', 'es'))
1874+ True
1875+ >>> 'Python is amazing'.endswith('is', 0, 9)
1876+ True
1877+
1878+ See also :meth: `startswith ` and :meth: `removesuffix `.
18671879
18681880
18691881.. method :: str.expandtabs(tabsize=8)
You can’t perform that action at this time.
0 commit comments