1from jinja2 import Environment 2 3env = Environment( 4 line_statement_prefix="#", variable_start_string="${", variable_end_string="}" 5) 6print( 7 env.from_string( 8 """\ 9<ul> 10# for item in range(10) 11 <li class="${loop.cycle('odd', 'even')}">${item}</li> 12# endfor 13</ul>\ 14""" 15 ).render() 16) 17