Python IF Statement
False Values:
None, 0, empty string, empty list, empty dictionary
Boolean False:
True, False
1, 0
Operators:
==, !=, <, <=, >, >=
and
or
not
Important:
Python doesn't have ! operator,
IDLE 2.6.6
>>> st = 'my non empty string'
>>> if(!st):
SyntaxError: invalid syntax
>>>
>>> if(not st):
print "Empty String"
else:
print "Non Empty String"
Non Empty String
>>>