I have the following line of code in Python:
if (sheet1.cell_value(i,8).lower()==sheet2.cell_value(0,j).lower() or (if hasattr(sheet2.cell_value(2,j), 'lower'): if sheet1.cell_value(i,8).lower()==sheet2.cell_value(2,j).lower())):
I currently get a SyntaxError: invalid syntax error
The reason I try to use this or, if statements is that sheet2.cell_value(2,j) may not have a value in Excel (in which case it would be #VALUE!) in Excel. Thus, the second if in the or sheet1.cell_value(i,8).lower()==sheet2.cell_value(2,j).lower())): must be evaluated only in case there is a value in the cell.. How can I fix that? Thanks
:in ifs in Python...if True or if False: passdemonstrates the problem nicely.