On 14/6/2013 3:03 μμ, Denis McMahon wrote:
for i, month in enumerate(months):
   if i != 0:
     print('<option value="%s"> %s </option>' % (i, month) )
   else:
     print('<option value="%s"> %s </option>' % ("==========", month) )

This s exactly what i was looking for Denis, thank you.

I tough of that myself too, but i had implemented it wrongly as:

for i, month in enumerate(months):
        if i == 0:
                i = "=========="
        else:
                print('<option value="%s"> %s </option>' % (i, month))


I just cant think simple and clear some times.

Of course as you also said i could have left it as it it is and then look for month == 0 in the if condition instead of month == "============"


--
What is now proved was at first only imagined!
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to