In Python 2.x, <> is equivalent to !=, as described in the documentation:
The forms <> and != are equivalent; for consistency with C, != is preferred; where != is mentioned below <> is also accepted. The <> spelling is considered obsolescent.
In Python 3.x, <> has been removed. Again, the documentation says:
Removed Syntax
....
Removed <> (use != instead).