這篇文章主要介紹了詳解python中executemany和序列的使用方法的相關資料,需要的朋友可以參考下
詳解python中executemany和序列的使用方法
一程式碼
import sqlite3 persons=[ ("Jim","Green"), ("Hu","jie") ] conn=sqlite3.connect(":memory:") conn.execute("CREATE TABLE person(firstname,lastname)") conn.executemany("INSERT INTO person(firstname,lastname) VALUES(?,?)",persons) for row in conn.execute("SELECT firstname,lastname FROM person"): print(row) print("I just deleted",conn.execute("DELETE FROM person").rowcount,"rows")
二運行結果
y ======== ('Jim', 'Green') ('Hu', 'jie') I just deleted 2 rows
以上是python中關於executemany以及序列的實例詳解的詳細內容。更多資訊請關注PHP中文網其他相關文章!