检查相同数字的相等性返回False

时间:2018-05-09 02:38:45

标签: python equality

作为Python的初学者,我无法理解为什么检查两个数字的相等性总是返回False而不管它们的值如何。我应该使用另一个运算符来检查两个数字是否相等?我将不胜感激。

for index in range(len(array)):
    for index2 in range(len(array)):
        if(index!=index2):
            print array[index2][2]==index,array[index2][2],index,"\n"

Array是元组列表,其中第三项元组包含数字。

输出:

False 1 0 

False 1 0 

False 1 0 

False 6 0 

False 7 0 

False 1 0 

False 7 0 

False 8 0 

False 8 0 

False 0 1 

False 1 1 

False 1 1 

False 6 1 

False 7 1 

False 1 1 

False 7 1 

False 8 1 

0 个答案:

没有答案
相关问题