Skip to content

Instantly share code, notes, and snippets.

@storborg
Created October 8, 2012 20:57
Show Gist options
  • Save storborg/3854930 to your computer and use it in GitHub Desktop.
Save storborg/3854930 to your computer and use it in GitHub Desktop.
>>> from mako.template import Template
>>>
>>> templ = Template('''
... % for el in els:
... <p>${el}</p>
... % else:
... <p>No elements.</p>
... % endfor
... ''')
>>>
>>> print templ.render(els=range(4))
<p>0</p>
<p>1</p>
<p>2</p>
<p>3</p>
<p>No elements.</p>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment