mirror of
https://github.com/python/cpython.git
synced 2026-04-20 10:51:00 +00:00
gh-106318: Add example for str.swapcase() method (#144575)
This commit is contained in:
parent
ee2775cfae
commit
d11e9ff8ca
1 changed files with 16 additions and 2 deletions
|
|
@ -2775,8 +2775,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