I want to write a method that takes a string and a dict. The method should scan the string and replace every word that inside {word} with the value of the dic["word"].
Example:
s = "Hello my name is {name} and I like {thing}"
dic = {"name": "Mike", "thing": "Plains"}
def rep(s, dic):
return "Hello my name is Mike and I like Plains"
I mean its a simple problem, easy to solve, but I search for the nice python way.