Changing delimiter
suggest changeYou can change the “$” delimiter to any other. The following example:
from string import Template
class MyOtherTemplate(Template):
delimiter = "#"
data = dict(id = 1, name = "Ricardo")
t = MyOtherTemplate("My name is #name and I have the id: #id")
print(t.substitute(data))
You can read de docs here
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents