@@ -2508,6 +2508,23 @@ expression support in the :mod:`re` module).
25082508 Return ``True `` if all cased characters [4 ]_ in the string are lowercase and
25092509 there is at least one cased character, ``False `` otherwise.
25102510
2511+ For example:
2512+
2513+ .. doctest ::
2514+
2515+ >>> ' banana' .islower()
2516+ True
2517+ >>> ' BANANA' .islower()
2518+ False
2519+ >>> ' baNana' .islower()
2520+ False
2521+ >>> ' ' .islower()
2522+ False
2523+ >>> ' ' .islower()
2524+ False
2525+
2526+ See also :meth: `isupper ` and :meth: `lower `.
2527+
25112528
25122529.. method :: str.isnumeric()
25132530
@@ -2612,6 +2629,10 @@ expression support in the :mod:`re` module).
26122629 Return ``True `` if all cased characters [4 ]_ in the string are uppercase and
26132630 there is at least one cased character, ``False `` otherwise.
26142631
2632+ For example:
2633+
2634+ .. doctest ::
2635+
26152636 >>> ' BANANA' .isupper()
26162637 True
26172638 >>> ' banana' .isupper()
@@ -2620,7 +2641,10 @@ expression support in the :mod:`re` module).
26202641 False
26212642 >>> ' ' .isupper()
26222643 False
2644+ >>> ' ' .isupper()
2645+ False
26232646
2647+ See also :meth: `islower ` and :meth: `upper `.
26242648
26252649
26262650.. _meth-str-join :
@@ -2672,10 +2696,25 @@ expression support in the :mod:`re` module).
26722696 >>> ' Lower Method Example' .lower()
26732697 'lower method example'
26742698
2699+ Note that ``s.lower().islower() `` might be ``False `` if ``s ``
2700+ contains uncased characters or if the Unicode category of the resulting
2701+ character(s) is not "Lu" (Letter, uppercase), but for instance "Lt" (Letter,
2702+ titlecase).
2703+
2704+ For example, see the word "Python" written in Punjabi:
2705+
2706+ .. doctest ::
2707+
2708+ >>> ' ازگر' .lower().islower()
2709+ False
2710+
2711+
26752712 The lowercasing algorithm used is `described in section 3.13.2 'Default Case
26762713 Conversion' of the Unicode Standard
26772714 <https://www.unicode.org/versions/Unicode18.0.0/core-spec/chapter-3/#G34078> `__.
26782715
2716+ See also :meth: `islower ` and :meth: `upper `.
2717+
26792718
26802719.. method :: str.lstrip(chars=None, /)
26812720
@@ -3179,15 +3218,33 @@ expression support in the :mod:`re` module).
31793218.. method :: str.upper()
31803219
31813220 Return a copy of the string with all the cased characters [4 ]_ converted to
3182- uppercase. Note that ``s.upper().isupper() `` might be ``False `` if ``s ``
3221+ uppercase.
3222+
3223+ For example:
3224+
3225+ .. doctest ::
3226+
3227+ >>> ' Upper Method Example' .upper()
3228+ 'UPPER METHOD EXAMPLE'
3229+
3230+ Note that ``s.upper().isupper() `` might be ``False `` if ``s ``
31833231 contains no cased characters or if the Unicode category of the resulting
3184- character(s) is not "Lu" (Letter, uppercase), but e.g. "Lt" (Letter,
3232+ character(s) is not "Lu" (Letter, uppercase), but for instance "Lt" (Letter,
31853233 titlecase).
31863234
3235+ For example, see the word "Python" written in Punjabi:
3236+
3237+ .. doctest ::
3238+
3239+ >>> ' ازگر' .upper().isupper()
3240+ False
3241+
31873242 The uppercasing algorithm used is `described in section 3.13.2 'Default Case
31883243 Conversion' of the Unicode Standard
31893244 <https://www.unicode.org/versions/Unicode18.0.0/core-spec/chapter-3/#G34078> `__.
31903245
3246+ See also :meth: `isupper ` and :meth: `lower `.
3247+
31913248
31923249.. method :: str.zfill(width, /)
31933250
0 commit comments