None != ""
. You should be testing with the is not
operator:
if lis is not None:
Note that you shouldn't be using != None
as others have suggested. From PEP8
Comparisons to singletons like None should always be done with
is
oris not
, never the equality operators.
EDIT: as per the discussion in the comments, lis
should be assigned as follows:
lis = excel.ActiveWorkbook.Activesheet.Range(cell).GetValue()