Skip to content
Myr

cycle.py

This file

Path

examples/basic/cycle.py

16 lines · 301 bytes · Python

Last changed by

Merge pull request #1136 from pallets/drop-python2David Lordbefore adoption3915eb5

History of this file

Take it

1from jinja2 import Environment23env = 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# endfor13</ul>\14"""15    ).render()16)