list1 = ["Mike", "", "Emma", "Kelly", "", "Brad"]
[i for i in list1 if i]
['Mike', 'Emma', 'Kelly', 'Brad']
Why is it that simply saying "if i" works?
Why doesn't i==True work? Or why doesn't i==False return anything?
I ask because the following code returns a list of booleans:
for i in list1:
print (i != "")
True
False
True
True
False
True
Thank you,
R user