Jeremy Jones, el jueves 29 de diciembre a las 22:39 me escribiste:
> >This would be simple using JSP or ASP, but I'm drawing a blank on how  
> >to do this in Kid.
> >
> >(Don't want to use templates, but that's life.)
> >
> I typically do it something like this:
> 
> <?python
> chunked_list = map(None, *[iter(some_list)]*2)

This looks like perl! =P
(but is a really good compact way to express it =)

> ?>
> <table>
>    <tr py:for="row in chunked_list">
>        <td py:for="image in row" align="center">
>        </td>
>    </tr>
> </table>

This is a little longer but could be more undestandable by
non-that-experienced python programmers:

<table>
   <tr py:for="row in xrange(int(math.ceil(len(some_list)/3.0)))">
       <td py:for="col in some_list[3*row:3*row+3]">
       </td>
   </tr>
</table>

-- 
Leandro Lucarella (luca) | Blog colectivo: http://www.mazziblog.com.ar/blog/
 .------------------------------------------------------------------------,
  \  GPG: 5F5A8D05 // F8CD F9A7 BF00 5431 4145  104C 949E BFB6 5F5A 8D05 /
   '--------------------------------------------------------------------'
Forgive your enemies, but never forget their names

Reply via email to