Skip to content

Commit

Permalink
Update stdtypes.rst with edits to content
Browse files Browse the repository at this point in the history
- Add example for optional *start* in `str.startswith()`
- Add ref link for Unicode Properties linking to the Howto section
  • Loading branch information
blaisep authored May 27, 2024
1 parent 031bf40 commit 08fcf55
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions Doc/library/stdtypes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1899,7 +1899,7 @@ expression support in the :mod:`re` module).
from the `Alphabetic property defined in the section 4.10 'Letters, Alphabetic, and
Ideographic' of the Unicode Standard
<https://www.unicode.org/versions/Unicode15.1.0/ch04.pdf>`_.
See Unicode Properties section in :ref:`unicode-howto`.
See Unicode Properties section in :ref:`unicode-howto-properties`.

.. method:: str.isascii()

Expand Down Expand Up @@ -2449,15 +2449,18 @@ If the separator is not found, return a 3-tuple containing
True
>>> 'a tuple of prefixes'.startswith(('at', 'in'))
False
>>> 'a tuple of suffixes'.startswith(('at', 'a'))
True

With optional *start*, test string beginning at that position::

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

With optional *end*, stop comparing string at that position::

>>> 'Python is amazing'.startswith('is', 7)
>>> 'Python is amazing, yet not mysterious'.startswith('ama', 10, 15)
True

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

0 comments on commit 08fcf55

Please sign in to comment.