A bit of a simpler workaround which I use:
my_string = 'Hello {name}, my name is {my_name}!'
to_replace = {
"search_for" : "replace_with",
"name" : "minerz029",
}
for search_str in to_replace:
my_string = my_string.replace('{' + search_str + '}', to_replace[search_str])
print(my_string)
This can be expanded easily with more keys in the to_replace
dict and wont complain even if the search string doesn't exist. It could probably be improved to offer more of .format()
's features, but it was enough for me.