put multiple condition in if statement
steve at REMOVETHIScyber.com.au
Sat Mar 11 07:01:23 CET 2006
On Fri, 10 Mar 2006 21:12:57 -0800, Allerdyce.John 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 ( (str != " ") && (str != "") ):
File "<stdin>", line 1
if ( (str != " ") && (str != "") ):
SyntaxError: invalid syntax
Hmmm... it looks like && is a syntax error in Python. That's probably
because Python isn't C or Java or whatever language you're trying to
program in :-)
Python has operators and, or, not that will do what you are trying to do.
You may want to read these first:
More information about the Python-list