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]
我使用上面的代码来检索客户详细信息 - 但是当我这样做时出现以下错误:
File "G:\ICT\SADS.py", line 111, in editdetails
print "Customer ID : " , row[0]
TypeError: 'NoneType' object has no attribute '__getitem__'
我尝试使用 while 循环或 for row in rows 但它真的让我很紧张,但它不起作用 - 请帮助:(