Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # replace_multiple_strings_via_lambda.py
- repls = ('ABC', 'XYZ'), ('There', 'World')
- s = 'ABC: Hello, There !!!'
- print reduce(lambda a, kv: a.replace(*kv), repls, s)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement