python搜索中的“builtin_function_or_method”object is not iterable“错误?

2024-05-18 23:07:37 发布

您现在位置:Python中文网/ 问答频道 /正文

我试图在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

我该怎么解决?任何帮助都乐意告知


Tags: 函数代码in功能id数据库newfor

热门问题