Python String translate() Method
Given a string, translate replaces characters in that string with other characters as specified in the supplied "translation" and returns the new string. A translation is simply a map of characters, and the characters to those characters with.
One would typically use the maketrans method to create the translation map.
||Required. The map containing the characters to replace with their replacements|
src = 'Hi Marc!' translation = src.maketrans('Marc', 'Kyra') translated = src.translate(translation) print(translated)