A certainl part of an if() structure never gets executed.

Denis McMahon denismfmcmahon at gmail.com
Fri Jun 14 08:03:33 EDT 2013


On Wed, 12 Jun 2013 11:54:25 +0300, Νικόλαος Κούρας wrote:

> So, i must tell:
> 
> for i, month in enumerate(months):
>      print('<option value="%s"> %s </option>' % (i, month) )
> 
> to somehow return '==========' instead of 0 but don't know how.

You could test for (month == 0) instead of re.search('=', month)? 

Or you could try using "==========" instead of i when i is 0

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) )

But if you couldn't work either of these solutions out on your own, 
perhaps the really important question you need to be asking yourself 
right now is "should I even be trying to code this in python when my 
basic knowledge of python coding is so poor?"

-- 
Denis McMahon, denismfmcmahon at gmail.com



More information about the Python-list mailing list