Skip to content

Commit 4328d06

Browse files
kovanclaude
andcommitted
gh-72798: Use .. doctest:: directive for str.translate example
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 5828e9b commit 4328d06

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

Doc/library/stdtypes.rst

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2847,7 +2847,9 @@ expression support in the :mod:`re` module).
28472847
character-to-character mappings in different formats.
28482848

28492849
The following example uses a mapping to replace ``'a'`` with ``'X'``,
2850-
``'b'`` with ``'Y'``, and delete ``'c'``::
2850+
``'b'`` with ``'Y'``, and delete ``'c'``:
2851+
2852+
.. doctest::
28512853

28522854
>>> 'abc123'.translate({ord('a'): 'X', ord('b'): 'Y', ord('c'): None})
28532855
'XY123'

0 commit comments

Comments
 (0)