mirror of
https://github.com/python/cpython.git
synced 2026-05-07 11:01:09 +00:00
[3.14] gh-106318: Add example for str.swapcase() method (GH-144575) (#148296)
Co-authored-by: Adorilson Bezerra <adorilson@gmail.com>
This commit is contained in:
parent
88fc1e6003
commit
571c337a5d
1 changed files with 16 additions and 2 deletions
|
|
@ -2771,8 +2771,22 @@ expression support in the :mod:`re` module).
|
|||
.. method:: str.swapcase()
|
||||
|
||||
Return a copy of the string with uppercase characters converted to lowercase and
|
||||
vice versa. Note that it is not necessarily true that
|
||||
``s.swapcase().swapcase() == s``.
|
||||
vice versa. For example:
|
||||
|
||||
.. doctest::
|
||||
|
||||
>>> 'Hello World'.swapcase()
|
||||
'hELLO wORLD'
|
||||
|
||||
Note that it is not necessarily true that ``s.swapcase().swapcase() == s``.
|
||||
For example:
|
||||
|
||||
.. doctest::
|
||||
|
||||
>>> 'straße'.swapcase().swapcase()
|
||||
'strasse'
|
||||
|
||||
See also :meth:`str.lower` and :meth:`str.upper`.
|
||||
|
||||
|
||||
.. method:: str.title()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue