Python 列表无法识别数据库中的值 Table

Python List not recognising values from a Database Table

我想知道为什么代码无法识别字段值 10 / 11 在列表 ['10', '11'] 内,以及为什么它会绕过初始 if 语句。

任何可能的解决方案将不胜感激,在代码下方还有在代码 运行.

之后产生的打印语句
    TableRow = DBSelect.fetchall()
    for Field in TableRow:
        print(Field, "This is the currently looped ID")
        print(EList, "This is the EList")
        if Field in EList : # compares each  ID against the EList
            print(EList, "This is pre- modified EList")
            EList.pop([Field]) # removes the ID from EList
            print(EList, "This is post- modified EList")
            UnavailableE = UnavailableE + 1 #Add to the number of unavailable E
            print(UnavailableE, "This is the Unavailable e in the loop")
        elif UnavailableE == ECount: # if the UnavailableE is Equal to  ECount, then no ID available - runs this output
            print("No e available")
        else:  
            print("Not in list")

为了进一步参考,这里是由此产生的打印语句:

10 这是当前循环的ID

['10', '11'] 这是 EList

不在列表中

11 这是当前循环的ID

['10', '11'] 这是 EList

不在列表中

如果 Field 不是字符串(数字?)或字符串 "10",则它 不在列表中 ,因为该列表包含字符串 "10 ""11 "(注意尾随空格)。

for Field in TableRow:
    Field = Field.strip()
    print(Field, "This is the currently looped ID")
    print(EList, "This is the EList")

添加条带以从字段中去除开始和结束的空白