put multiple condition in if statement

Terry Hancock hancock at anansispaceworks.com
Sat Mar 11 05:13:44 EST 2006


On 10 Mar 2006 21:12:57 -0800
Allerdyce.John at gmail.com wrote:
> How can I put multiple condition in if statement?
> I try this, but I can't get that to work.
> 
> if ( (str != " ") && (str != "") ):

if s!=' ' and s!='':

1) logical operators are words
2) don't overload standard type names

this is actually better style:

if s not in (' ', ''):



-- 
Terry Hancock (hancock at AnansiSpaceworks.com)
Anansi Spaceworks http://www.AnansiSpaceworks.com




More information about the Python-list mailing list