Python string maketrans() is an inbuilt mapping function that maps the characters of a string to its replacement or, in other words, its translation. The maketrans() is a helper method for the translate() method. It helps the translate method by returning a translation table that is used for one to one mapping of string characters. It specifies the list of characters that are needed to be replaced from the main string or to be deleted.

Python String maketrans()

Python string maketrans() function returns the mapping table for translation usable for the translate() method.

In simple terms, the Python maketrans() method is the static method that creates one to one mapping of the character to its translation/replacement.

#python #python string maketrans #maketrans

Python String maketrans() Method Example
1.30 GEEK