[英]python sqlite executemany statement error: ValueError: parameters are of unsupported type
我想做的事情似乎應該非常簡單,但我無法克服我遇到的錯誤。 基本上,我創建一個列表,創建一個數據庫表,然后想要將列表的元素插入表中。 這是我得到的:
F_wheel_data = [1,3,1,3,1,3,1,3,1,3,2,1,3,1,3,1,3,1,3,1,3,4]
curs.execute('CREATE TABLE F_wheel (url_num INTEGER NOT NULL)')
curs.executemany('INSERT INTO F_wheel VALUES (?)', F_wheel_data)
而我得到的錯誤是:
curs.executemany('INSERT INTO F_wheel VALUES (?)', F_wheel_data)
ValueError: parameters are of unsupported type
是什么賦予了?
查看executemany()
這個文檔 ,您需要傳遞一個元組列表。
F_wheel_data = [1,3,1,3,1,3,1,3,1,3,2,1,3,1,3,1,3,1,3,1,3,4]
F_wheel_data = [(i,) for i in F_wheel_data]
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.