def preformat(msg):""" allow \{\{key}} to be used for formatting in textthat already uses curly braces. First switch this intosomething else, replace curlies with double curlies, and thenswitch back to regular braces"""msg = msg.replace('\{\{', '<<<').replace('}}', '>>>')msg = msg.replace('{', '\{\{').replace('}', '}}')msg = msg.replace('<<<', '{').replace('>>>', '}')return msg
from jinja2 import Template
foo = Template('''#include <stdio.h>
void main() {printf("hello universe number \{\{number}}");}''')
for i in range(2):print(foo.render(number=i))