[3.13] gh-106318: Add example for str.isalpha() (GH-137557) (#141902)

Co-authored-by: Adorilson Bezerra <adorilson@gmail.com>
Co-authored-by: Éric <merwok@netwok.org>
Co-authored-by: Victor Stinner <vstinner@python.org>
This commit is contained in:
Hugo van Kemenade 2025-11-24 16:29:49 +02:00 committed by GitHub
parent e2188c7e5e
commit a676b2e00f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 14 additions and 0 deletions

View file

@ -352,6 +352,8 @@ If you don't include such a comment, the default encoding used will be UTF-8 as
already mentioned. See also :pep:`263` for more information.
.. _unicode-properties:
Unicode Properties
------------------

View file

@ -1921,6 +1921,18 @@ 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>`_.
For example:
.. doctest::
>>> 'Letters and spaces'.isalpha()
False
>>> 'LettersOnly'.isalpha()
True
>>> 'µ'.isalpha() # non-ASCII characters can be considered alphabetical too
True
See :ref:`unicode-properties`.
.. method:: str.isascii()