I want to iterate over the list and print the elements separated by the ',' character, without a comma. I can’t just ', '.join(headings)because of the formation and shielding. But the following obviously leaves me with a trailing comma.
% for x in headings:
<a href='#${x|u}'>${x}</a>, \
% endfor
Or in the general case: when repeating something in a Mako template, is there a way to find out if I reached the last element (or the first or nt)?
source
share