Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions Doc/library/stdtypes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2316,11 +2316,25 @@ expression support in the :mod:`re` module).
strings (of arbitrary lengths) or ``None``. Character keys will then be
converted to ordinals.

For example:

.. doctest::

>>> str.maketrans({'a': 'A', 'b': 'Boo', 'c': None})
{97: 'A', 98: 'Boo', 99: None}

If there are two arguments, they must be strings of equal length, and in the
resulting dictionary, each character in *from* will be mapped to the character at
the same position in *to*. If there is a third argument, it must be a string,
whose characters will be mapped to ``None`` in the result.

For example:

.. doctest::

>>> str.maketrans('ab', 'AB', 'c')
{97: 65, 98: 66, 99: None}


.. method:: str.partition(sep, /)

Expand Down
Loading