What does <> mean in Python

What is the meaning of <> in Python?

I tried to search it on Google, but I can not get into the search query ...

I have not seen this in any other language, otherwise I would try to find it.

+6
source share
5 answers

<> is an alternative spelling of != , an inequality check statement. IIRC, it was removed in Python3.

 >>> "foo" <> "bar" True >>> "foo" <> "foo" False 
+15
source

This is an obsolete inequality operator. See the Python documentation.

! = can also be written <>, but this obsolete use is preserved in the reverse order of compatibility only. New code should always use! =.

+3
source

This is the same as! = ("Not equal")

+2
source

<> means not equal to . <> and != have the same meaning.

From docs :

The forms <> and! = Are equivalent; for consistency with C,! = is preferred; where! = indicated below <> is also accepted. <> spelling is considered obsolete.

+1
source

the operator & lt> is the same as! =, which means not equal

 if thing1 <> thing2: code here 
0
source

All Articles