Newbie: last item of a loop

Sven Brandt sven_NOSPAM at manastar.de
Fri May 2 08:02:03 EDT 2003


Hi,

to those familiar with Zope:
Is there an equivalent the the tag variable of dtml-in 'sequence-end'?

In "python-speak":
how do I determin that the current item in a for loop is the last 
(first) item of a sequence?

Is there a more efficiant (in terms of cpu-resources) way than:

for i in my_sequence:
   if i.index < len(my_sequenec):
   print "Last item!"

Regards
Sven





More information about the Python-list mailing list