我试图在python上编写一个搜索函数,它在数据库中搜索客户ID(用于登录功能),下面是代码:
def search_ID():
import sqlite3 # imports SQlite library
new_db = sqlite3.connect('LightningParties.db')
c = new_db.cursor()
c.execute("SELECT * FROM Customer_Details WHERE ID=?",(CustomerIDSave,))
results = c.fetchall # fetches all of the ID's not just one
for row in results:
forename1 = (column[1])
每当我尝试运行此程序时,我都会不断收到此错误:
File "F:/stuff that actually works/customer_login.py", line 29, in search_ID
for row in results: TypeError:
'builtin_function_or_method' object is not iterable
我该怎么解决?任何帮助都乐意告知
尝试添加parens:
您应该在运行方法并分配它返回的内容时分配方法。
相关问题 更多 >
编程相关推荐