6. maketrans() :- It is used to map the contents of string 1 with string 2 with respective indices to be translated later using translate().
7. translate() :- This is used to swap the string elements mapped with the help of maketrans().
python - Sample - python code :
python programming - Output :
In the above code, ‘g’ is replaced by a, ‘f’ is replaced by b and ‘o’ is replaced by ‘c’ in the string using translate function.
8. replace() :- This function is used to replace the substring with a new substring in the string. This function has 3 arguments. The string to replace, new string which would replace and max value denoting the limit to replace action ( by default unlimited ).
Wikitechy tutorial site provides you all the learn python , learn to program in python , python coding class , learn python programming language online , learn python coding , learn how to code python , free python course online , python training online free , python book , python developer , python online course free
Related Searches to Python String Methods | Part 3 - strip, lstrip, rstrip, min, max, maketrans, translate and replace
replace pythonpython join listpython uppercasepython string methodspython string comparepython string functionslower pythonpython translatestring methods pythonpython print to filecompare strings pythonpython slice stringjoin in pythonlen pythonpython lenformat pythonstring format pythonpython string substringstring in pythonwhat is a string in pythonpython string format examplerstriplstrippython string methods strippython rstriprstrip pythonpython lstriplstrip pythonlstrip rstrip pythonruby lstripline rstripstring rstripminminutemininsql minmin sqlmaximum and minimumminminmin browsermin a minmaxmax 2015the maxmax softwarebest friend maxwww maxmax onlinemax filmmax the dogmax logomax linemax marinemax traini maxmaketranspython maketransstring maketransstring maketrans pythonstring maketrans python 3translate & relplace)python string translatetranslate pythonstring translatestring translate pythonpython 3 translatestr translatetranslate string