Code:
dict={'a':'123','b':'456','c':'789'}
string='abc'
print(string.maketrans(dict))
dict={97:'123',98:'456',99:'789'}
string='abc'
print(string.maketrans(dict))
#Translational table using two string
firstString='abc'
secondString='def'
string='abc'
print(string.maketrans(firstString,secondString))
#Translational table using removable string
firstString='abc'
secondString='def'
thirdString='abd'
string='abc'
print(string.maketrans(firstString,secondString,thirdString))
#partition
string='Python is fun'
print(string.partition('is '))
print(string.partition('not '))
string="Python is fun, isn't it"
print(string.partition('is'))
Nesta página do site você pode assistir ao vídeo on-line 134. String Maketrans and Partition Method in Python with Example Code || Python String Methods-16 duração online em boa qualidade , que foi baixado pelo usuário Bhavatavi 04 Outubro 2022, compartilhe o link com seus amigos e conhecidos, no youtube este vídeo já foi visto 8 vezes e gostou 0 espectadores. Boa visualização!