Python not equal operator


Python use != for not equal comparison. To determine whether two objects are identical or not, use is and is not.

>>> x = 1
>>> y = 2
>>> z = 1
>>> x != y
True

>>> x != z
False

>>> z is x
True