这篇文章主要介绍了详解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中文网其它相关文章!
python怎么学习?python怎么入门?python在哪学?python怎么学才快?不用担心,这里为大家提供了python速学教程(入门到精通),有需要的小伙伴保存下载就能学习啦!
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号