Scroll Down to See All▾
absaiterallanextanyasciibinboolbreakpointbytearraybytescallablechrclassmethodcompilecomplexdelattrdictdivmodenumerateevalexecfilterfloatformatfrozensetgetattrglobalshasattrhashhelphexidinputintisinstanceissubclassiterlenlistlocalsmapmaxmemoryviewminnextobjectoctopenordpowprintpropertyrangereprreversedroundsetsetattrslicesortedstaticmethodstrsumsupertupletypevarszip__import__clear_(dict)clear_(list)clear_(set)copy_(dict)copy_(list)copy_(set)fromkeysgetitemskeyspop_(dict)pop_(list)pop_(set)popitemsetdefaultupdatevaluescount_(tuple)count_(list)count_(str)index_(tuple)index_(list)index_(str)adddifferencedifference_updatediscardintersectionintersection_updateisdisjointissubsetissupersetremove_(set)remove_(list)symmetric_differencesymmetric_difference_updateunionupdateclosefilenoflushisattyreadreadablereadlinereadlinesseekseekabletelltruncatewritablewritewritelinesappendextendinsertreversesortcapitalizecasefoldcenterencodeendswithexpandtabsfindformatisalnumisalphaisasciiisdecimalisdigitisidentifierislowerisnumericisprintableisspaceistitleisupperjoinljustlowerlstrippartitionreplacerfindrindexrjustrpartitionrsplitrstripsplitsplitlinesstartswithstripswapcasetitletranslateupperdirzfillFunction Details: maketrans
Description
Return a translation table usable for str.translate().
Extended Description
The maketrans() method creates a translation table that can be used with the translate() method to replace specified characters. It can be called in two ways: with a dictionary mapping characters to their replacements, or with two strings of equal length where characters in the first string are replaced by the corresponding characters in the second string.
Read More about maketrans from Python Documentation
Function Signature
Module: builtins
Class: str
Parameters
Parameter List
- x: Union[dict, str]
- y: str
- z: str
Return
Returns a dictionary suitable for use with translate().
Return Type
dict
Output
Explanation
This example demonstrates creating a translation table to replace 'a' with '1', 'b' with '2', and 'c' with '3'.