mardi 8 décembre 2020

Python if function with multiple conditions including none

I am trying to make an if statement that checks for 2 things: 1)if x is None 2)if x is [] (empty list)

However I can't seem to combine the two into one equation

This is what I tried:

x = None
if x is not None or x != []:
print("x is not none or empty list")

desired result in this situation is that it prints nothing, but it still prints out. What am I doing wrong?

Aucun commentaire:

Enregistrer un commentaire