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.
<>
is an alternate spelling of !=
, the inequality test operator. IIRC, it has been removed in Python3.
>>> "foo" <> "bar"
True
>>> "foo" <> "foo"
False
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 !=.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With