SQLite python再次出错

SQLite python再次出错,python,sqlite,Python,Sqlite,我使用上面的代码来检索客户详细信息,但这样做时会出现以下错误: conn = sqlite3.connect('SADS.db') cur = conn.cursor() print " " choice = raw_input("Does the Customer know their user ID? Y/N : ") if choice == "N": number = raw_input("What is their phone number? : ")

我使用上面的代码来检索客户详细信息,但这样做时会出现以下错误:

conn = sqlite3.connect('SADS.db')
cur = conn.cursor()
print " "
choice = raw_input("Does the Customer know their user ID? Y/N : ")
if choice == "N":
        number = raw_input("What is their phone number? : ")
        cur.execute("SELECT * FROM customers WHERE Telephone = (?)", (number,))
        row = cur.fetchone()
        print "Customer ID : " , row[0]

这真的让我很紧张,我试过使用while循环或for row-in-rows,但它不起作用-请帮助:(

您确定您输入的电话号码在表中吗?似乎找不到具有输入电话号码的客户。我建议使用字符串格式创建查询并打印查询以验证查询。还要检查电话列中的条目的格式(222.222.2222/(222)222-2222/等)并向用户显示该格式。@JamesThiele:否!如果可以使用SQL参数,则不要使用字符串格式。SQL参数使数据库有机会计划查询(并重新使用计划),并使客户端库有机会正确引用,从而防止SQL注入攻击。
  File "G:\ICT\SADS.py", line 111, in editdetails
print "Customer ID : " , row[0]
TypeError: 'NoneType' object has no attribute '__getitem__'
row = cur.fetchone()
if row is None:
    print "Telephone number not found"
else:
    print "Customer ID : " , row[0]