[ZPT] Question about controlling repeat loops

Dieter Maurer dieter@handshake.de
Mon, 12 Aug 2002 21:37:02 +0200


Peter C. Norton writes:
 > Is there a way to make a loop structure using templates to do roughly
 > the following in python:
 >  
 > >>> loop = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
 > >>> i = 0
 > >>> while i < len(loop):
 > ...  print loop[i]
 > ...  i = i+1
 > ...  print ("Yeah and one %d" % loop[i])
 > ...  i = i + 1 
No, but I would do it like this

     build a list of lists in a Python script
     and use a nested "repeat" in the page template


Dieter