Advertisement
Peaser

dicttrans

Aug 26th, 2015
390
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.19 KB | None | 0 0
  1. def dictTrans(string, dict):
  2.     for i in dict:
  3.         string = string.replace(i, dict[i])
  4.     return string
  5.  
  6.  
  7.  
  8. test = "hello, world!"
  9. tab = {"hello": "goodbye"}
  10. print dictTrans(test, tab)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement