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

Fábio Santos fabiosantosart at gmail.com
Wed Jun 12 05:57:21 EDT 2013


On 12 Jun 2013 10:29, "Νικόλαος Κούρας" <support at superhost.gr> wrote:
>
> On 12/6/2013 12:07 μμ, F�bio Santos wrote:
>>
>> On Wed, Jun 12, 2013 at 9:54 AM, Νικόλαος Κούρας <support at superhost.gr>
wrote:
>>>
>>> but if enumerate yields 0 instead of '==========' then elif '=' not in
>>> year of course fails.
>>>
>>> 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.
>>> --
>>> http://mail.python.org/mailman/listinfo/python-list
>>
>>
>> Well, you could try this:
>>
>>> for i, month in enumerate(months):
>>>      if i == 0:
>>>          month = ('=' * 10)
>>>      print('<option value="%s"> %s </option>' % (i, month) )
>>
>>
>> No?
>
>
> I'am afraid not Fabio, i just tried byt sumbitting only the year, not
name not month
>
> after printign the valeus to see what went wrong, the values look like:
>
> ========== 0 2010
>
> instead of:
>
> ========== ==========  2010
>
> ========== is the value of the month when its not selected by the user,
but even with your suggestions it reurns t0 intead of the equal signs.....
>
> --
> http://mail.python.org/mailman/listinfo/python-list

Have you tried

i = month = '=' * 10

I had assumed you just wanted those equal signs for the user display.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20130612/17499fab/attachment.html>


More information about the Python-list mailing list