【Python】插入sqlite数据库

import sqlite3
from datetime import datetime
 
conn = sqlite3.connect('data.db')
print("Opened database successfully")
 
for i in range(100):
    time = datetime.now()
    conn.execute("INSERT INTO test(time,url,imgPath) VALUES (?,?,?)", (time, "www.test.com", "c:/data/" + str(i)))
 
conn.commit()
conn.close()

 

posted @ 2018-03-04 11:35  Dsp Tian  阅读(638)  评论(0编辑  收藏  举报