Using python code in pyjade
问题 I'm trying to generate a list using pyjade, like so: ul - for i, (label, link) in enumerate(tabs) li(class="selected" if i == selected_index else "") a(href=link)= label But I see this error: UndefinedError: 'enumerate' is undefined I must be embedding python code into Jade wrong. What's the right way to do this? 回答1: Jade uses what I refer to as "implicit enumeration" - it enumerates values in a list simply by adding one more variable, i , than there are values to unpack: for item, i in list