De Wiki inetshell
Saltar a: navegación, buscar

https://www.programiz.com/python-programming/methods/string/translate

# first string
firstString = "abc"
secondString = "ghi"
thirdString = "ab"

string = "abcdef"
print("Original string:", string)

translation = string.maketrans(firstString, secondString, thirdString)

# translate string
print("Translated string:", string.translate(translation))