[問題] 撈取SQLite資料筆數問題
各位大大們好,小弟目前在自學 Python ,近期想使用 Python 取出每天爬到並匯入到
SQLite 的資料筆數
資料存入的格式如下圖:
https://i.imgur.com/WJap8QB.png

程式碼如下:
import sqlite3
conn = sqlite3.connect('sqlite01.db')
c = conn.cursor()
print ("Opened database successfully")
time = " 2018-09-30T%"
cur = c.execute("select count(*) from my_data where update_time like
'?'",time)
data = cur.fetchone()
print(data)
conn.commit()
print("Records created successfully")
conn.close()
但都會出現此行的錯誤訊息
--- > cur = c.execute("select count(*) from my_data where update_time like
'?'",time)
=錯誤訊息=
ProgrammingError: Incorrect number of bindings supplied. The current
statement uses 0, and there are 8 supplied.
不知道這部分該如何處理比較適合,想請大大們幫忙解惑,感謝!
--
※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 122.146.117.88
※ 文章網址: https://www.ptt.cc/bbs/Python/M.1538376718.A.19C.html
推
10/01 16:29,
6年前
, 1F
10/01 16:29, 1F
→
10/01 18:18,
6年前
, 2F
10/01 18:18, 2F
推
10/01 19:24,
6年前
, 3F
10/01 19:24, 3F
→
10/02 00:40,
6年前
, 4F
10/02 00:40, 4F
→
10/02 00:40,
6年前
, 5F
10/02 00:40, 5F
推
10/02 09:19,
6年前
, 6F
10/02 09:19, 6F
→
10/02 13:33,
6年前
, 7F
10/02 13:33, 7F
Python 近期熱門文章
PTT數位生活區 即時熱門文章
10
41