I want to replace the following chars with their corresponding values (from the dictionary) in one string:
dictVal =
{
'a' : 'W',
'p' : 2,
'd' : 5
}
Is there a more elegant way of doing this instead of iterating over ever key of the dictionary?
For example:
input string = 'Please help me'
output string = 'PleWse hel2 me'
Thanks.