How would you say does not equal?
(你怎么说不相等?)
Like
(喜欢)
if hi == hi:
print "hi"
elif hi (does not equal) bye:
print "no hi"
Is there something equivalent to ==
that means "not equal"?
(有没有相当于==
东西意味着“不平等”?)
How would you say does not equal?
(你怎么说不相等?)
Like
(喜欢)
if hi == hi:
print "hi"
elif hi (does not equal) bye:
print "no hi"
Is there something equivalent to ==
that means "not equal"?
(有没有相当于==
东西意味着“不平等”?)
Use !=
.
(使用!=
。)
(查看比较运算符 。)
For comparing object identities, you can use the keywordis
and its negation is not
. (对于比较对象标识,您可以使用关键字is
而其否定is not
。)
eg
(例如)
1 == 1 # -> True
1 != 1 # -> False
[] is [] #-> False (distinct objects)
a = b = []; a is b # -> True (same object)