Easiest way to replace a string using a dictionary of replacements?

Posted by Fedor on Stack Overflow See other posts from Stack Overflow or by Fedor
Published on 2010-03-08T10:08:23Z Indexed on 2010/03/08 10:21 UTC
Read the original article Hit count: 285

Filed under:
|

Consider..

dict = {
'?????':'?????',
'russianA':'englishA'
}

s = '????? russianA'

I'd like to replace all dict keys with their respective dict values in s.

© Stack Overflow or respective owner

Related posts about python

Related posts about re