什么是Python<>操作员 [英] What is the Python <> operator
本文介绍了什么是Python<>操作员的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
Python中的<>
运算符到底是什么?为什么据我所知它没有记载?
What exactly is the <>
operator in Python, and why is it undocumented (as far as I can tell)?
与!=
或is not
相同吗?
推荐答案
在 Python 2.x ,<>
与!=
相同(即不等于" ,而不是is not
,不等于" ),但是后者是首选:
In Python 2.x, <>
is the same as !=
(i.e. "not equal to", rather than is not
which is "not identical to"), but the latter is preferred:
比较运算符
<>
和!=
是同一运算符的备用拼写.!=
是首选拼写;<>
过时了.
The comparison operators
<>
and!=
are alternate spellings of the same operator.!=
is the preferred spelling;<>
is obsolescent.
在3.x版本中,<>
已被删除,只有
In 3.x, <>
has been removed and only !=
exists.
这篇关于什么是Python<>操作员的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文