We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 00ea776 commit 28df263Copy full SHA for 28df263
1 file changed
Doc/library/stdtypes.rst
@@ -2851,6 +2851,14 @@ expression support in the :mod:`re` module).
2851
>>> 'abc123'.translate({ord('a'): 'X', ord('b'): 'Y', ord('c'): None})
2852
'XY123'
2853
2854
+ For example, removing vowels using :meth:`str.maketrans`:
2855
+
2856
+ .. doctest::
2857
2858
+ >>> table = str.maketrans('', '', 'aeiou')
2859
+ >>> 'hello world'.translate(table)
2860
+ 'hll wrld'
2861
2862
See also the :mod:`codecs` module for a more flexible approach to custom
2863
character mappings.
2864
0 commit comments