diff --git a/Doc/builtins/stdtypes.rst b/Doc/builtins/stdtypes.rst index 7afd2b4d293595..fa83593ec49476 100644 --- a/Doc/builtins/stdtypes.rst +++ b/Doc/builtins/stdtypes.rst @@ -2629,6 +2629,10 @@ expression support in the :mod:`re` module). Return ``True`` if all cased characters [4]_ in the string are uppercase and there is at least one cased character, ``False`` otherwise. + For example: + + .. doctest:: + >>> 'BANANA'.isupper() True >>> 'banana'.isupper() @@ -2696,6 +2700,8 @@ expression support in the :mod:`re` module). Conversion' of the Unicode Standard `__. + See also :meth:`islower` and :meth:`upper`. + .. method:: str.lstrip(chars=None, /) @@ -3199,15 +3205,33 @@ expression support in the :mod:`re` module). .. method:: str.upper() Return a copy of the string with all the cased characters [4]_ converted to - uppercase. Note that ``s.upper().isupper()`` might be ``False`` if ``s`` + uppercase. + + For example: + + .. doctest:: + + >>> 'Upper Method Example'.upper() + 'UPPER METHOD EXAMPLE' + + Note that ``s.upper().isupper()`` might be ``False`` if ``s`` contains no cased characters or if the Unicode category of the resulting - character(s) is not "Lu" (Letter, uppercase), but e.g. "Lt" (Letter, + character(s) is not "Lu" (Letter, uppercase), but for instance "Lt" (Letter, titlecase). + For example, see the word "Python" written in Punjabi: + + .. doctest:: + + >>> 'ازگر'.upper().isupper() + False + The uppercasing algorithm used is `described in section 3.13.2 'Default Case Conversion' of the Unicode Standard `__. + See also :meth:`isupper` and :meth:`lower`. + .. method:: str.zfill(width, /)