Python String translate() Method

Last Updated : 2 Jan 2026

Python translate() method a string in which each character has been mapped through the given translation table. We can use maketrans() method to create a translation map from character-to-character mappings in different formats.

Syntax of the Python String translate() Method

It has the following syntax:

Parameters

  • table: A translation table.

Return

It returns a string.

Python String translate() Method Example

Let's take an example to demonstrate the translate() method to understand it's functionality.

Output:

Hellp jgvgtppint
 
Next TopicPython Strings