from jinja2 import Template text = """ {{ text1 }} {{ text2 }} """ tmpl = Template(text) print( tmpl.render( text1 = "TEST" ) )