Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

what does <> mean in Python

Tags:

python

What is the meaning of <> in Python?

I have tried searching for it on Google but I cannot seem to get inside the search term...

I have not seen this in any other language also otherwise I would have tried to find it.

like image 445
user225312 Avatar asked Jan 19 '11 17:01

user225312


2 Answers

<> is an alternate spelling of !=, the inequality test operator. IIRC, it has been removed in Python3.

>>> "foo" <> "bar"
True
>>> "foo" <> "foo"
False
like image 50
Dirk Avatar answered Sep 23 '22 12:09

Dirk


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

!= can also be written <>, but this is an obsolete usage kept for backwards compatibility only. New code should always use !=.

like image 25
Gavin H Avatar answered Sep 23 '22 12:09

Gavin H