Question

I need to generate a HTML using a Genshi template. The Html is, basicaly a very long html with tables. The data comes in a simple CSV, so, i read it with python, i put it into a list[] and then i call the template and send the variable (the list)

Actually i solved it by doing something like this in the template:

<html>
<?python>
    for i in t:
       for e in tp[i]:
           print "<SOME_HTML_TAGS>"
</?>
</html>

But, the idea is to use the Genshi funcions (such as loops, etc)

I read the manual, and I see that a simple for is done like this:

<li py:for="fruit in fruits">      
I like ${fruit}s                   
</li>    

But, how do i do a loop inside a loop (nested for loops)???

Was it helpful?

Solution

<table>
<tr py:for="i in t">      
<td py:for="e in tp[i]">
${e}s
</td>
</tr>
</table>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top