Advertisement
here2share

# replace_multiple_strings_via_lambda.py

Sep 9th, 2015
200
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.17 KB | None | 0 0
  1. # replace_multiple_strings_via_lambda.py
  2.  
  3. repls = ('ABC', 'XYZ'), ('There', 'World')
  4. s = 'ABC: Hello, There !!!'
  5. print reduce(lambda a, kv: a.replace(*kv), repls, s)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement