Python 3 中的 == 运算符如何工作?

pythonserver side programmingprogramming更新于 2025/8/6 13:32:17

== 符号定义为相等运算符。如果两边的表达式相等,则返回 true;如果不相等,则返回 false

>>> (10+2) == 12
True
>>> 5*5 == 5**2
True
>>> (10/3)==3
False
>>> 'computer'=="computer"
True
>>> 'COMPUTER'.lower()=='computer'
True

相关文章


有用资源