Changing delimiter

suggest change

You 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

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents