Works as expected here, the 'else' part is not executed if the 'if' part is true.
Python 2.5.1 (r251:54869, Apr 18 2007, 22:08:04) [GCC 4.0.1 (Apple Computer, Inc. build 5367)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> def tr(): ... print "tr func" ... return "Sander" ... >>> def fa(): ... print "fa func" ... return "Harry" ... >>> s = "yes" if tr() == "Sander" else fa() tr func >>> s 'yes' >>> s = "yes" if tr() == "San" else fa() tr func fa func >>> s 'Harry' >>> Can you show your code? bigden007 wrote: > > Hi, > I have a if..else statement in my script. The statements all execute > fine, but the problem is , even if the IF part of the statement is > true, the else part executes as well. The verion of pythin i use 2.5 > Any help is appreciatiated. > > Regards > > Big Den. > > -- > http://mail.python.org/mailman/listinfo/python-list > > -- View this message in context: http://www.nabble.com/if..else-stmt-tf4670106.html#a13340589 Sent from the Python - python-list mailing list archive at Nabble.com. -- http://mail.python.org/mailman/listinfo/python-list