Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions Doc/library/stdtypes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2735,6 +2735,21 @@ expression support in the :mod:`re` module).
test string beginning at that position. With optional *end*, stop comparing
string at that position.

For example:

.. doctest::

>>> 'Python'.startswith('Py')
True
>>> 'a tuple of prefixes'.startswith(('at', 'in'))
False
Comment on lines +2744 to +2745
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
>>> 'a tuple of prefixes'.startswith(('at', 'in'))
False

IMO we don't need two examples with a tuple.

>>> 'a tuple of prefixes'.startswith(('at', 'a'))
True
>>> 'Python is amazing'.startswith('is', 7)
True

See also :meth:`endswith` and :meth:`removeprefix`.


.. method:: str.strip(chars=None, /)

Expand Down
Loading