首页 > 解决方案 > 比较两个相等的变量时,程序没有识别出它们相等>

问题描述

我正在比较两个变量,我知道它们是相等的,但是在比较结束时发现不 = 1:

asearchid=searchid.get()
asearchid=IntVar()
found = 0
with open ('competitordetails.txt','rU') as csvfile:
    reader = csv.reader(csvfile)
    for row in reader:
        compidfound = row[0]
        compidfound = IntVar()
        if(asearchid == compidfound):
            found = 1
        else:
            found = 0
print(found)

我将这两个变量更改为 IntVar,但它仍然无法正常工作

标签: python

解决方案


推荐阅读