Path: csiph.com!usenet.pasdenom.info!news.franciliens.net!news.muarf.org!nntpfeed.proxad.net!proxad.net!feeder1-2.proxad.net!usenet-fr.net!nerim.net!novso.com!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.129 X-Spam-Level: * X-Spam-Evidence: '*H*': 0.74; '*S*': 0.00; 'elif': 0.05; '"0"': 0.16; '10:54,': 0.16; 'andreas': 0.16; 'bye,': 0.16; 'fails.': 0.16; 'wrote:': 0.18; 'select': 0.22; 'header:User-Agent:1': 0.23; 'posts': 0.26; 'gets': 0.27; 'header:In-Reply-To:1': 0.27; "i'm": 0.30; 'code': 0.31; 'them?': 0.31; 'yields': 0.31; 'actual': 0.34; 'problem': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'replies': 0.36; 'entry': 0.36; 'should': 0.36; 'wrong': 0.37; 'so,': 0.37; 'received:10': 0.37; 'message-id:@gmail.com': 0.38; 'problems': 0.38; 'checks': 0.38; 'to:addr:python-list': 0.38; 'does': 0.39; 'to:addr:python.org': 0.39; 'how': 0.40; 'most': 0.60; 'tell': 0.60; 'course': 0.61; 'show': 0.63; 'telling': 0.64; '8bit%:100': 0.72; 'filling': 0.78; 'how.': 0.84; 'subject:gets': 0.84 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:subject:references :in-reply-to:content-type:content-transfer-encoding; bh=76q0yVlP5SrUEkOxQI2Sjir5lR+DkLFM3eCJr7HQQiE=; b=zi8XiltKU0Tv7I+s/Hz3XCxZA4Pa50UKwe81sN5YELEpWf3v/VonxC8lf1XJmrF3U0 71f3q4G0HFjxhZ25cvkZcP8ZE9Vmtw0EUsJxkMDAnylcL0x6sWXMeZ8KPTwftvxcqVeu hM3z2kLn0Qbp3PxRFa3nD6W0nAkCHxwiZ8hpz0NcgDHKBO4NWWIvgJJxMPXYVLmS9R3z M3b9fuPnjNcbDeVoWZtq7E28PhFmyaiB86wfNf4QmeyVzwHGPT2kXw0SsXB73q4h7vB0 58VNSlYCXEbsLWw888pnMNWgc0ysh+qu+Ft5675/ATcYeNte3goYXwer17njiF/eeJXG ZF+A== X-Received: by 10.204.60.142 with SMTP id p14mr2970688bkh.11.1371031678061; Wed, 12 Jun 2013 03:07:58 -0700 (PDT) Date: Wed, 12 Jun 2013 12:07:54 +0200 From: Andreas Perstinger User-Agent: Mozilla/5.0 (X11; Linux i686; rv:17.0) Gecko/20130510 Thunderbird/17.0.6 MIME-Version: 1.0 To: python-list@python.org Subject: Re: A certainl part of an if() structure never gets executed. References: <2bc90d3b-09c2-4315-9357-ff7f039465e0@googlegroups.com> In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 36 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1371031686 news.xs4all.nl 15922 [2001:888:2000:d::a6]:41569 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:47770 [Please trim your replies to the relevant parts.] On 12.06.2013 10:54, Νικόλαος Κούρας wrote: > But when it comes to select '==========' from month instead of > '==========' to be submitted a zero gets submitted and i think the > problem is the way i'm filling up months into the drop down menu which is: > > > for i, month in enumerate(months): > print('' % (i, month) ) > > > the if case does not execute because of the way it checks for None entry > which is: elif '=' not in year: > > but if enumerate yields 0 instead of '==========' then elif '=' not in > year of course fails. How often do we need to tell you that you should reread your posts before sending them? You start with telling us you have problems with "month" and then show us code regarding "year" > So, i must tell: > > for i, month in enumerate(months): > print('' % (i, month) ) > > to somehow return '==========' instead of 0 but don't know how. As with most of your problems you are barking up the wrong tree. Why not use the actual value you get from the form to check whether you have a valid month? Do you understand why "0" is submitted instead of "=========="? Bye, Andreas