!=和<>有什么区别? [英] What is the difference between != and <>?

查看:173
本文介绍了!=和<>有什么区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

也许这是一个相当新手的问题,但我很好奇.我已经尝试过搜索,但是我想我缺少正确搜索的正确术语.

Perhaps this is a rather newbie-ish question, but I'm curious. I have tried searching for it, but I suppose I lack the correct terminology to search properly.

!=<>之间的差异.

在再次搜索不平等"时,我发现其中一个讨论了not ==!=,但没有讨论<>.

On searching again, "inequality", I found one that discusses not == and !=, but nothing about <>.

推荐答案

在Python 2.x中,<>等效于!=,如

In Python 2.x, <> is equivalent to !=, as described in the documentation:

<>和!=的形式是等效的;为了与C保持一致,最好使用!=;其中下面提到的!=也被接受<>. <>拼写被认为是过时的.

The forms <> and != are equivalent; for consistency with C, != is preferred; where != is mentioned below <> is also accepted. The <> spelling is considered obsolescent.

在Python 3.x中,<>已被删除.再次,文档说:

In Python 3.x, <> has been removed. Again, the documentation says:

已删除语法

....

已删除<>(改用!=).

Removed <> (use != instead).

这篇关于!=和&lt;&gt;有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆