0
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)
當執行上面的代碼給出了一個錯誤的東西像「builtin_function_or_method」對象有沒有屬性「執行」的cursor.ececute(聲明)
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執行這個查詢?
你需要調用'光標= c.cursor()' – PRMoureu
你試過 'c.cursor.execute(select_statement中)'? –
@MuhammadAsif你讀過db-api文檔嗎? –