Python Challenge] Level1. maketrans()
str.maketrans(intab, outtab]);
Parameters
-
intab − This is the string having actual characters.
-
outtab − This is the string having corresponding mapping character.
example code :
intab = "aeiou" outtab = "12345" trantab = str.maketrans(intab, outtab) str = "this is string example....wow!!!" print (str.translate(trantab))
Result
When we run above program, it produces the following result −
th3s 3s str3ng 2x1mpl2....w4w!!!
by.