I was working on reading some data from excel. However, i have countered a simple if statement. Not quite sure what have i missed. When i run my code, it will not go into the if statement but it will instead jump to else statement even though the value specified is exactly the same. below is my code. Thank you in advance!
from openpyxl import load_workbook
wb = load_workbook()
sheet_ranges = wb['Sheet1']
xd_date_count = 3
cookie = sheet_ranges['A' + str(xd_date_count)].value # i have a value "None" stored in A3 in this excel
print(cookie) # when i print this, it prints out None
if cookie == "None":
print("ok")
else:
print("no")
cookieis"None"and notNone? The former would happen for a cell with the literal text "None", whereas the latter would happen for an empty cell, probablyprint(repr(cookie), repr("None"))to check what Green Cloak Guy suggested