gpt4 book ai didi

python - 'builtin_function_or_method' 对象没有 cursor.execute(statement) 的属性 'execute'

转载 作者:行者123 更新时间:2023-11-28 22:25:43 32 4
gpt4 key购买 nike

<分区>

c = sqlite3.connect(history_db)
cursor = c.cursor

select_statement = "SELECT urls.urls,urls.Visit_count FROM urls,Visits WHERE
urls.id=visits.urls;"
cursor.execute(select_statement)

results = c.cursor.fetchcall()

print(results)

上面的代码在执行时给出类似的错误

Traceback (most recent call last):
File "test.py", line 13, in <module>
cursor.execute(select_statement)
AttributeError: 'builtin_function_or_method' object has no attribute
'execute'

我刚开始使用 python sqlite3,那么如何在 python 中使用 sqlite3 执行此查询?

32 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com