Inserting a python variable to template string to use HTMLTemplateFormatter

Hi,

Is there any better way to insert a python variable to template string to use
HTMLTemplateFormatter

I did:
kast=‘Kastamonu’
template_il="""<div style=“background:<%=
(function colorfromint(){
if (il.indexOf(’”""+kast+"""’) !== -1){
return(“orange”)}
}()) %>;
color: black">
<%= value %>

“”"
formatter_il = HTMLTemplateFormatter(template=template_il)

when I used python string format:
I got:
“”".format(kast)
ValueError: unexpected ‘{’ in field name

regards

Hi @ahmettemiz88 please edit your post to use code formatting so that the code is intelligible (either with the </> icon on the editing toolbar, or triple backtick ``` fences around the code blocks)